檢查不出來我的代碼有什么問題啊- -。
<!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("是否打開新窗口");
? ? if(open==ture)
? ? {var url=prompt("確認打開的網(wǎng)址"," http://idcbgp.cn");
? ? if(url!=null)
? ? {window.open(url,"_blank",'width=400,height=500,menubar=no,toolbar=no');}
else
{alert("再見!");}
} ??
else
{alert("再見!");}
? ? }
? ??
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2016-04-16
1、var url=prompt("確認打開的網(wǎng)址"," http://idcbgp.cn"? ?逗號
2、?if(open==ture) ? true
2016-04-16
if(open==ture)改為if(open==true)
2016-04-16
第九行代碼 ?你將true寫錯成ture了;還有第10行代碼,你兩個參數(shù)中間的逗號使用了中文的逗號,以及網(wǎng)址里面的冒號也是使用的中文的冒號,都改成英文的就好了,在我的電腦上執(zhí)行是這樣的。
2016-04-16
第一個if判斷語句的 true 拼錯了