<!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 open=confirm("确认新建窗口打开网站吗?");if(open==true) // 新窗口打开时弹出确认框,是否打开{var url=prompt("通过输入对话框,确定打开的网址","http://www.imooc.com");if(url!=null) // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/{window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no'); } //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。else{alert("再见!");}} else{alert("再见!");}请问Window.open(url,……)中URL是什么意思?代码中if和else是如何对应的,第一个if对应最后一个else,还是第一个else呢?
1 回答
Tobey_滔
TA贡献242条经验 获得超128个赞
<!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 open=confirm("确认新建窗口打开网站吗?");
if(open==true){
// 新窗口打开时弹出确认框,是否打开
var url=prompt("通过输入对话框,确定打开的网址","http://www.imooc.com");
if(url!=null){
// 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
window.open(url,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');
} else{
//打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
alert("再见!");
}
}else{
alert("再见!");
}
}
openWindow();
</script>我帮你整理好了!!希望采纳关注
添加回答
举报
0/150
提交
取消
