冰神舞
2015-03-29 15:49
<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
function openWindow(){
// 新窗口打开时弹出确认框,是否打开
var mychar=confirm("窗口是否打开?");
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
if(mychar==true)//打开
{
var myurl=prompt("确定打开的网址:","http://www.imooc.com")
if(myurl!=null)//有输入
{
window.open(myurl,"_blank","width=400,height=500,menubar=no,toobar=no");
}
else{
//空白
}
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
}
else{
document.write("没有打开窗体<br>");
}//没打开
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
function wopen(){
var message=confirm("打开新窗口?");
if(message=ture)
var wap=prompt("新窗口:");
if(wap!=null);
window.open("http://www.imooc.com",'_blank',width=400,height=500,menubar=no,toolbar=no);
else{
alert("结束!")
}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
JavaScript入门篇
741596 学习 · 9869 问题
相似问题