1、新窗口打开时弹出确认框,是否打开
提示: 使用 if 判断确认框是否点击了确定,如点击弹出输入对话框,否则没有任何操作。
2、通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
3、打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
function button1()
{
var message1=confirm("please choose yes ro no?");
if(message1==true)
{
var message2=prompt("please enter your website","http://www.imooc.com/");
if(message2!=null)
{var message3=window.open('message2','width=400,height=500,menubar=no,toolbar=no');}
else
{document.write("bye1");}
}
else
{document.wriet("bye2!");}
}
----------------
<body>
<input type="button" value="打开" onclick="button1()" />
</body>
- if-else表达式里面的js语句,“;”号放在{}的后面
- 第一个if的else表达式,怎么样才能运行出来?用{document.write}不可以,目前只能想到alert的弹窗
- window.open方法,打开404,怎么解决?