慕函数1124787
2019-02-12 11:00
<!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 dakai=confirm("是否打开该网页?");
if (dakai==true)
{var b=prompt("确定打开的网址","http://www.imooc.com/");
if(b=true)
{window.open('http://www.imooc.com/','_blank',width=400,height=500)}
else
{document.write("拜拜");}
}
else
{document.write("拜拜");}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
业务逻辑上出问题了,你应该把prmpot()获取到的 Boolean值的判断写在confirm()的判断内,
JavaScript入门篇
739817 学习 · 9566 问题
相似问题