或許是最簡潔且得體的答案了,我是說或許……
<!DOCTYPE html> <html> <head> <title>new window</title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function openWindow(){ var b = confirm("確定新建窗口?");// 新窗口打開時彈出確認框,是否打開 if(b){ var url=prompt("請輸入網址:", "www.xianlaiwan.cn");// 通過輸入對話框, if(url != null){ window.open("http://"+url, '_blank', 'width=400px,height=500px,menubar=no,toolbar=no');//打開的窗口要求,寬400 } } } </script> </head> <body> <input type="button" value="新窗口打開網站" onclick="openWindow()"> </body> </html>