救命啊問題出在哪……連彈窗都沒有
<!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 a=confirm("是否打開網頁");
???? if(a=true);
???? {var b=prompt("打開網址","http://www.xianlaiwan.cn/")};
???????? if(b=null);
???????? { window.open(_blank,'http://www.xianlaiwan.cn/','width=400,height=500,menubar=no,toolbar=no'); }
???????? else{window.open(blank,b,'width=400,height=500,menubar=no,toolbar=no')};
????? else {};
}
? </script>
?</head>
?<body>
?? <input type="button" value="新窗口打開網站" onclick="openWindow()" />
?</body>
</html>
2018-07-19
你的if-else的寫法有問題,分號不是這樣加的。而且要用“==”而不是“=”,“=”是賦值。你可以調整一下格式寫成這樣。
2018-07-19
還有的是open的參數順序有顛倒,應該是open("url","名稱","參數列表");
所以應該寫成:
2018-07-19
判斷是否為真時,用==表示相等,一個=代表賦值。