煩請大神看看錯在哪
<!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 a=confirm("是否打開網(wǎng)頁?")
??? // 新窗口打開時彈出確認框,是否打開
if(a==true)
{var b=prompt("通過輸入對話框,確定打開的網(wǎng)頁","http://idcbgp.cn/")
if(b==true)
{window.open(c,'width=400,height=500,menubar=no,toolbar=no')};
else{alert("bye")}}
else{alert("bye")}}
??? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
??? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
???
???
? </script>
?</head>
?<body>
?? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2019-06-21
第一:prompt這個返回的值不是true或false,返回的是null或非空,所以判斷語句中b==true就是錯的;
第二:打開窗口語句中的c從哪來的,并且單引號沒有,除此之外,打開的窗口是新窗口還是原有窗口也沒寫