求大神幫我看看哪錯(cuò)了
<!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 a00=confirm("是否新建窗口網(wǎng)站") ;
??? if(a00==true)
??? {
??????? var b11=prompt("確認(rèn)網(wǎng)址","http//idcbgp.cn/");
??????? if(b11==null)
??????? {
??????????? window.open('http//idcbgp.cn/','_blank','width=400px,heught=500px,menubar=no,toolbar=no');
??????? }
??????? else{
??????????? document.write("錯(cuò)誤");
??????? }
???????????
???? }
??????? else{
??????????? document.write("錯(cuò)誤");
??????? }
??? }
??? </script>
?</head>
?<body>
?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2018-08-17
正解:if(b11!=null)
????{
? ? ? ? ? window.open ('_blank','width=400px,heught=500px,menubar=no,toolbar=no');
??????? }
兩個(gè)錯(cuò)誤,第一:當(dāng)不輸入時(shí),因?yàn)榈诙?shù)已賦值,確認(rèn)后直接跳轉(zhuǎn)默認(rèn)網(wǎng)頁,取消則返回為null。第二window.open第一參數(shù)為網(wǎng)頁路徑,可為空或不寫。