可以按照我的設(shè)計(jì)思路幫我檢查一下代碼嗎
<!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 myopen=confirm("是否新窗口打開(kāi)網(wǎng)站");
??? // 新窗口打開(kāi)時(shí)彈出確認(rèn)框,是否打開(kāi)
???
??? if(myopen==true)
??? {
??????? var myweb=prompt("請(qǐng)輸入你要打開(kāi)的網(wǎng)址");
??????? // 通過(guò)輸入對(duì)話框,確定打開(kāi)的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
???????
??????? if(myweb!=null)
??????? {window.open(myweb,"_blank","width=400,height=500,menubar=no,toolbar=no");
??????? }
??????? else
??????? {window.open("http://idcbgp.cn/","_blank","width=400,height=500,menubar=no,toolbar=no")}
??????? //打開(kāi)的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
???????
??? else
??? {document.write("慕課網(wǎng)功能很強(qiáng)大,可以嘗試打開(kāi)哦~http://idcbgp.cn/")}
??? }?
? </script>
?</head>
?<body>
?? <input type="button" value="新窗口打開(kāi)網(wǎng)站" onclick="openWindow()" />
?</body>
</html>
2016-10-14
if(myopen==true),這個(gè)感覺(jué)是沒(méi)有錯(cuò)的,confim消息對(duì)話框語(yǔ)法就是==
2016-10-14
??
?else?{window.open("http://idcbgp.cn/","_blank","width=400,height=500,menubar=no,toolbar=no")}
這段和if(myweb!=null)的重復(fù)了。
還有就是if(myopen==true),為什么有兩個(gè)"="號(hào)?
?還有這一段"var myweb=prompt("請(qǐng)輸入你要打開(kāi)的網(wǎng)址");"網(wǎng)址是要在括號(hào)里面填寫,這樣寫var myweb=prompt("請(qǐng)輸入你要打開(kāi)的網(wǎng)址","http://idcbgp.cn/");。同樣是這段代碼,你把http后面的“:”寫成了中文下的”:“。
最后提示:寫代碼的時(shí)候一定要區(qū)分中英文的寫法。
貼上我?guī)湍阈薷倪^(guò)的代碼,按照你的思路改的。
?function openWindow()
?{
????var myopen=confirm("是否新窗口打開(kāi)網(wǎng)站");?// 新窗口打開(kāi)時(shí)彈出確認(rèn)框,是否打開(kāi)
? ??????if(myopen=true)
????????{
? ? var myweb=prompt("請(qǐng)輸入你要打開(kāi)的網(wǎng)址","http://idcbgp.cn/");
? ? ? ? // 通過(guò)輸入對(duì)話框,確定打開(kāi)的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? ?????if(myweb!=null)
?????{window.open(myweb,'_blank','width=400,height=500,menubar=no,toolbar=no');}
? ? ? ? /* else?{alert("慕課網(wǎng)功能很強(qiáng)大,可以嘗試打開(kāi)哦~http:idcbgp.cn/");}*/
? ? ? ? else
? ? ? ?{document.write("慕課網(wǎng)功能很強(qiáng)大,可以嘗試打開(kāi)哦~http://idcbgp.cn/");}
? ? ? ? //打開(kāi)的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
? ???????} ? ??
? ? else
? ? {alert("再見(jiàn)!");}
? ? } ?