<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <script type="text/javascript"> function openWindow(){ var url="http://www.imooc.com/" var open = prompt("是否确认新增窗口打开新的网站?",url); if(open==url){ window.open("http://www.imooc.com/",'_blank','width=400,height=500,menubar=yes,topbar=yes'); } else{ alert("退出"); } } </script> </head> <body> <input name="button" type="button" onclick="openWindow()" value="点击打开新窗口"/> </body> </html>
可以的