請(qǐng)看下有什么問(wèn)題?點(diǎn)擊了按鈕后,沒(méi)有提示框出現(xià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("確定打開(kāi)新窗口?")
??? if(open==true)
??? {
??? var url=prompt("輸入網(wǎng)址:","http://idcbgp.cn")
???? if(url!=null)
???? {window.open(url,'_blank')}
???? else {alert("8888")}
??? }
??? else
??? {alert("再見(jiàn)")}
??? }
? </script>
?</head>
?<body>
???????? ? <input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2016-05-18
你這個(gè)一共有兩個(gè)問(wèn)題 ?
1 ? ??onclick="openWindow()" 與 function openwindow ?不一致 ?所以點(diǎn)擊無(wú)效果。
2 ? ??var url=prompt("輸入網(wǎng)址:","http://idcbgp.cn"? ?這里的: ?你用的是中文的: ?應(yīng)該是英文的:
2016-05-18
你的function openWindow()應(yīng)該大寫(xiě)W
2016-05-18
有兩句var沒(méi)有結(jié)束分號(hào)
2016-05-18
記住,語(yǔ)句結(jié)尾用“;”英文版的結(jié)束。