我實(shí)在看不出哪里錯(cuò)了,求大神解答?。?!
<!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("您確定要打開一個(gè)新的窗口么?");
? ? ? ? if(open==true){
? ? ? ? ? ? var url=prompt("請(qǐng)輸入您要打開的網(wǎng)址"," http://idcbgp.cn");
? ? ? ? ? ? if(url!=null){window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');
? ? ? ? ? ? ? ??
? ? ? ? ? ? }
? ? ? ? ? ? else{
? ? ? ? ? ? ? ? alert("再見");
? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? }
? ? ? ? else{
? ? ? ? ? ? alert("再見");
? ? ? ? }
? ? }
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? // 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2016-11-06
?var url=prompt("請(qǐng)輸入您要打開的網(wǎng)址"," http://idcbgp.cn");中間的去掉兩個(gè)雙引號(hào)
2016-11-06
額,我看到了,我自己也去查了一下,其實(shí)不是雙引號(hào)的問題,,問題出在了你的兩個(gè)標(biāo)點(diǎn)符號(hào)寫成了中文。。這個(gè)在網(wǎng)頁上不容易發(fā)現(xiàn),我把代碼復(fù)制到notepad++上才發(fā)現(xiàn)的。。第一個(gè)符號(hào)是var open=confirm("您確定要打開一個(gè)新的窗口么?");的分號(hào),第二個(gè)是var url=prompt("請(qǐng)輸入您要打開的網(wǎng)址"," http://idcbgp.cn")中間的逗號(hào)
2016-11-06
兩個(gè)else是什么鬼,而且url是空,對(duì)了,open==ture,這個(gè)不需要,直接寫open就可以了
2016-11-06
你的問題是什么呢?