請問哪里錯(cuò)了
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title>?
? <meta http-equiv="Content-Type" content="text/html; charset=utf-8">??
?? <script type="text/javascript">?
??? function openWindow()
???? {var open=confirm("確認(rèn)新建窗口打開網(wǎng)站嗎?")
???? if(open==ture)
??????? {
??????????? var url=prompt("通過確認(rèn)對(duì)話框,確認(rèn)打開窗口"," http://idcbgp.cn/")???
???????? if(url!=null)
?????????? {
????????????? window.open(url,"blank",'width=400,height=500,menubar=no,toolbar=no')?
?????????? }
????????? else
????????? {alert("再見!")}
??????? }
??????? else
??????? {alert("拜拜")}
????? }
? </script>
?</head>
?<body>
????? <input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
?</body>
</html>??
2016-07-26
首先你的第一個(gè)if判斷括號(hào)里open==true,你寫成了open=ture; ? ? true單詞拼錯(cuò)了,然后你的程序每句代碼都沒有分號(hào)結(jié)尾,再然后,你的window.open(url,"blank"...) , ?"blank"改成"_blank"。然后,你再試試?
2016-07-26
ture改成true 拼錯(cuò)了
2016-07-26
function openWindow()
{
? ?var openNew = confirm("是否打開新窗口?");
? ?if (openNew == true)
? ?{
? ? ? ?var openUrl = prompt("請確認(rèn)打開窗口網(wǎng)址:", "http://idcbgp.cn");
? ? ? ?if (openUrl!=null){
? ? ? ? ? ?window.open(openUrl, '_blank', 'width=400,height=500,menubar=no,status=no,toolbar=no');
? ? ? ?}
? ?}
}
2016-07-26
一個(gè)是 ; ?可能不寫有時(shí)候沒關(guān)系,最好寫上;最重要的是童鞋 ?你true 拼錯(cuò)了
2016-07-26
語法錯(cuò)誤,當(dāng)else為空時(shí),只寫if條件即可,把else這一條去掉就可以了
2016-07-26
缺少;
2016-07-26
大哥你的結(jié)束符呢?都沒有呀?。ńY(jié)束符“”;“”)試試可不可以