請問哪里錯了
<!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("確認新建窗口打開網站嗎?")
???? if(open==ture)
??????? {
??????????? var url=prompt("通過確認對話框,確認打開窗口"," http://www.xianlaiwan.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="新窗口打開網站" onclick="openWindow()" />
?</body>
</html>??
2016-07-26
首先你的第一個if判斷括號里open==true,你寫成了open=ture; ? ? true單詞拼錯了,然后你的程序每句代碼都沒有分號結尾,再然后,你的window.open(url,"blank"...) , ?"blank"改成"_blank"。然后,你再試試?
2016-07-26
ture改成true 拼錯了
2016-07-26
function openWindow()
{
? ?var openNew = confirm("是否打開新窗口?");
? ?if (openNew == true)
? ?{
? ? ? ?var openUrl = prompt("請確認打開窗口網址:", "http://www.xianlaiwan.cn");
? ? ? ?if (openUrl!=null){
? ? ? ? ? ?window.open(openUrl, '_blank', 'width=400,height=500,menubar=no,status=no,toolbar=no');
? ? ? ?}
? ?}
}
2016-07-26
一個是 ; ?可能不寫有時候沒關系,最好寫上;最重要的是童鞋 ?你true 拼錯了
2016-07-26
語法錯誤,當else為空時,只寫if條件即可,把else這一條去掉就可以了
2016-07-26
缺少;
2016-07-26
大哥你的結束符呢?都沒有呀?。ńY束符“”;“”)試試可不可以