怎么沒有結果~
<!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 myweb=confirm("確定打開新窗口嗎?");
? ? ? if(myweb==true)
? ? ? {
? ? ? ? ? var mychar=prompt("請輸入網址","http://www.xianlaiwan.cn");
? ? ? ? ? if(mychar!==null)
? ? ? ? ? {
? ? ? ? ? ? ? ?window.open(mrchar,"_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-18
alert("不打開新窗口");結尾這個封號應該是英文的,你輸成中文的了
2016-07-18
alert("不打開新窗口");結尾的分號應該是英文,你寫成中文了
'width=400','height=500','menubar=no','toolbar=no',應該寫成'width=400,height=500,menubar=no,toolbar=no'
2016-07-18
仔細看。
?var mychar=prompt("請輸入網址","http://www.xianlaiwan.cn");
? ? ? ? ? if(mychar!==null){
window.open(mrchar,"_blank",'width=400','height=500','menubar=no','toolbar=no');
}
mychar ? ? 和window.open中的URL ? ? ? mrchar ? ? ? 但是問題應該也不只是出在這里 ? 也可以這樣寫:
window.open(mychar,'_blank;,'width=400,height=500,menubar=no,toolbar=no');
}