<!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 myMessage=comfirm("是否打开"); if(myMessage == true){ var mywebsite = prompt("输入网址","http://www.imooc.com/"); if(mywebsite!=null){ window.open(mywebsite,'_blank','width=400,height=500,menubar=0,toolbar=0'); } } </script> </head> <body> <input type="button" value="新窗口打开网站" onclick="openWindow()" /> </body> </html>
comfirm -> confirm