这样可以实现
<!DOCTYPE html> <html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function openWindow() { const s = confirm("是否打开"); if (s==true) { const t = prompt("请输入您要打开的网址:"); window.open(t,'_blank','width=600,height=500,menubar=no,toolbar=no'); } else { return; } } </script> </head> <body> <input type="button" value="新窗口打开网站" onclick="openWindow()" /> </body> </html>