来个大神~
按照你的代码,我运行了一下是可以运行的,建议代码格式化一下,不然看起来有点混乱
<!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.hao123.com/"); if(b != null){ window.open(b,'width=400','height=500','menuber=no','tooblar'); }else{ alert("666666"); } }else{ alert("888888"); } } </script> </head> <body> <input type="button" value="新窗口打开网站" onclick="openWindow()" /> </body> </html>
window.open([URL], [窗口名称], [参数字符串]);
打开窗口的参数写错了,可改为window.open(b,"_blank","width=400,height=500,menubar=no,toolbar=no");