<!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 bt = confirm("是否打开?"); if(bt == true){ // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/ var message = prompt("在文本框中输入要打开的网址:", "如http://www.imooc.com"); } if(message!=null){ //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。 window.open("messgae","_blank","width=400, heigh=500,menubar=no,toolbar=no"); }else{ alert("再见!"); } else{ alert("再见!"); } } </script> </head> <body> <input type="button" value="新窗口打开网站" onclick="openWindow()" /> </body></html>
1 回答

sevencuijian
TA贡献5条经验 获得超1个赞
<!DOCTYPE html> <html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <script type="text/javascript"> function openWindow(){ // 新窗口打开时弹出确认框,是否打开 var bt = confirm("是否打开?"); if(bt == true){ // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/ var message = prompt("在文本框中输入要打开的网址:","如http://www.imooc.com"); if(message!=null){ //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。 window.open(message,"_blank","width=400,heigh=500,menubar=no,toolbar=no"); }else{ alert("再见!"); } }else{ alert("再见!"); } } </script> </head> <body> <input type="button" value="新窗口打开网站" onclick="openWindow()" /> </body> </html>
我觉得你应该要的是这个效果
添加回答
举报
0/150
提交
取消