为了账号安全,请及时绑定邮箱和手机立即绑定

请大神指教,小白真不懂

请大神指教,小白真不懂

短发是小丸子 2016-10-25 21:40:46
<!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>

我帮你整理好了!!希望采纳关注

查看完整回答
反对 回复 2016-10-25
  • 1 回答
  • 0 关注
  • 1180 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信