為什么無法運行
<!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 opentag=confirm("是否在新窗口打開網站?");
? ? ?if(opentag==true)
? ? ?{
? ? ? ? ?var webadress=prompt("請輸入網址","http://www.xianlaiwan.cn/");
? ? ? ? ?if(webadress!=null);
? ? ? ? ?{
? ? ? ? ? ? ?window.open(webadess,"_blank',width=400,height=500,menubar=no,toolbar=no');
? ? ? ? ?}
? ? ? ? ?else?
? ? ? ? ?{alert("結束");}
? ? ?}
? ? ?else?
? ? ? ? ?{alert("結束");}
?}
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網站" onclick="openWindow()" />?
?</body>
</html>
2017-02-16
你這個。。。。唉?。?)var opentag=confirm("是否在新窗口打開網站?");最后的分號用的中文的分好,改成英文的.(2)window.open(webadess,"_blank',width=400,height=500,menubar=no,toolbar=no');的webadress寫錯了webadess,而且你這里面的引號用的不規范(3)?if(webadress!=null);這句后面的分號去掉(4)<input type="button" value="新窗口打開網站" onclick="openWindow()" /> 你綁定的這個方法名字和你定義的不一樣,要區分大小寫的
2017-02-16
?window.open(webadess,"_blank',width=400,height=500,menubar=no,toolbar=no');
webadess寫錯了webadress
2017-02-16
去掉一個
else{alert("結束");}
2017-02-16
把兩個else去掉。