為什么兩個else就不能運(yùn)行呢?每個if語法對應(yīng)一個else不行嗎?
<!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 open = confirm("確認(rèn)打開新窗口");
??? if(open==true){var url = prompt("打開網(wǎng)址是否正確","http//:idcbgp.cn")}
????????? if(url!=null){window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');}
????????? else{alert("再見");}
??? else{alert("再見");}
??? }
</script>
?</head>
?<body>
?? ?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2016-10-22
?if(open==true)
{
????var url = prompt("打開網(wǎng)址是否正確","http//:idcbgp.cn");
?????if(url!=null)
????{window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');}
? ? ? ? else
????{alert("再見");}
???? }
? ? ? ? ?else{alert("再見");
要這樣嵌套