confirm()弹出两次窗口
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>close()</title> <script type="text/javascript"> var mywin=window.open("http://www.imooc.com"); if(confirm("is you want to close ?")){ mywin.close(); }else{ alert("now it is open!"); } </script> </head> <body> </body> </html>
萌新问一句,为什么会弹出两次confirm窗口呢?