為啥剪切別人的代碼就可以運(yùn)行,自己照原樣寫(xiě)的就運(yùn)行不了
<!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)新建窗口打開(kāi)網(wǎng)站嗎?");
???? // var dakai=confirm("是否打開(kāi)新的窗口");
????? var moren="http://idcbgp.cn/";
??? if(dakai==true)
??? // 新窗口打開(kāi)時(shí)彈出確認(rèn)框,是否打開(kāi)
??? {prompt(moren,moren);
??? // 通過(guò)輸入對(duì)話框,確定打開(kāi)的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
??? window.open('moren', '_blank', 'width=400 height=500 toolbar=no menubar=no');}
??? //打開(kāi)的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
?? else
?? {alert("nishibushipianwo");}
?? ?
? </script>
?</head>
?<body>
?
?? ?? <input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2017-03-12
看了一下- -
dakai改成open
函數(shù)的左大括號(hào)‘{’ 少了右大括號(hào)
在函數(shù)末尾加上去就好了
收到回復(fù)一下- -謝謝
2017-03-12
另外prompt的用法也錯(cuò)了- -。運(yùn)行不了
2017-03-12
你這里的dakai不是被注釋掉了么。。應(yīng)該用if(open==true){}