<!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 result=confirm("是否打開網頁?");? ? ? ? if(result===true)? ? ? ? {? ? ? ? ? ? var url=prompt("請輸入網頁","http://www.xianlaiwan.cn/");? ? ? ? ? ? if(url="http://www.xianlaiwan.cn/")? ? ? ? ? ? {? ? ? ? ? ? ? ? window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no')? ? ? ? ? ? }? ? ? ? ? ? else? ? ? ? ? ? {? ? ? ? ? ? ? ? document.write("操作不將繼續")? ? ? ? ? ? }? ? ? ? }? ? ? ? else? ? ? ? {? ? ? ? ? ? document.write("不將打開新網頁")? ? ? ? }? ?}? </script>??</head>??<body>? ?<input type="button" value="新窗口打開網站" onclick="openWindow()" />??</body></html>
prompt里的判斷語句else為什么不能阻止彈出新窗口(就是“http://www.xianlaiwan.cn/”這個網頁)?如何阻止?
Nina0223
2016-04-15 08:21:18