<html>
<head>
<title> new document </title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
<script type="text/javascript">
function openWindow()
{
var openorno=confirm("是否打开网址?");
if (openorno=true)
{
var openwhich=prompt("打开网址为:","http://www.imooc.com/")
if (openwhich=null){window.open("openwhich","_blank","width=400,height=500,menubar=no,toolbar=no");}
else{alert("已关闭!");}
}
else{alert("不打开网页!");}
}
</script>
</head>
<body>
<input type="button" value="新窗口打开网站" onclick="openWindow()" />
</body>
</html>
if (openorno=true)改为 if (openorno==true)
if (openwhich=null)改为if (openwhich!=null)
在第一个判断中应该是if(openorno==true) , 你少了一个‘=’号 因为if是判断语句 非0即1