大神們,錯(cuò)在哪?為什么警告對(duì)話框出不來?。。
<!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 boss=confirm("是否要打開新頁面?");
? ? if ?(boss==true){var shabi=prompt("請(qǐng)輸入網(wǎng)址:","http://idcbgp.cn");
? ? if(shabi="http://idcbgp.cn"){
? ? ? ? window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no');}
? ? if ? ?else(shabi!=null){alert("再見!");}
? ? }
else { alert("再見!");}
}
? ? // 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2016-08-24
? ? ? ? var boss=confirm("是否要打開新頁面?");
? ? if ?(boss==true){var shabi=prompt("請(qǐng)輸入網(wǎng)址:","http://idcbgp.cn");
? ? if(shabi=="http://idcbgp.cn"){
? ? ? ? window.open('http://idcbgp.cn','_blank','width=400,height=500,menubar=no,toolbar=no');}
? ? else {alert("再見!");}
? ? }
else { alert("再見!");}
}
2016-08-24
if(shabi="http://idcbgp.cn")中的判斷至少是"=="吧,或者用equals方法(沒驗(yàn)證過)。
?if ? ?else是什么鬼,只見過else if。
2016-08-24
if(shabi="http://idcbgp.cn")? 改成?if(shabi=="http://idcbgp.cn"),?2個(gè)等號(hào),不是一個(gè)等號(hào).
2016-08-24
你最后一組if(){}else寫的有問題