<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
function sb3(){
var sb=confirmc("要打开窗口吗?");
if (sb="ture"){var sb1= prompt("要打开网页吗","ttp://www.imooc.com/")};
if (sb1=ture){ window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no')};
elese{confirmc("下次再会。")};
elese{confirmc("下次再会。")};
}
// 新窗口打开时弹出确认框,是否打开
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="sb3()" />
</body>
</html>
2 回答
慕数据5775487
TA贡献76条经验 获得超19个赞
<!DOCTYPE html>
<html>
<head>
<title> new document </title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
function sb3(){
var sb=confirm("要打开窗口吗?");
if (sb==true){
var sb1= prompt("要打开网页吗","http://www.imooc.com");
if (sb1!=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="sb3()" />
</body>
</html>添加回答
举报
0/150
提交
取消


