问答详情
源自:2-7 编程练习

请问一下大家为什么慕课网打不开,在这段代码运行之后

http://www.imooc.com/code/1642

提问者:慕粉4370907 2016-11-29 10:52

个回答

  • didel
    2016-11-29 16:04:28

    上面的代码试了没有?


  • 混世小魔王ok
    2016-11-29 11:15:59

    <!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 meg=confirm("确认打开新窗口吗");

            if(meg==true){

            // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/

            //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。

                window.open('http://www.imooc.com',

                'width=400px,height=500px,menubar=no,toolbar=no');

            }

        }

      </script> 

     </head> 

     <body> 

     <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 

     </body>

    </html>

    这是我写的代码  这个很简单的  你写的有点复杂了

  • didel
    2016-11-29 11:09:41

    <!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 mysrt = confirm("是否打开网页");

                if (mysrt == true) {

                        // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/

                       var my = prompt("请输入网址", "http://www.imooc.com/");

     

                        if (my != null) {

        //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。

                            window.open(my, 'http://www.imooc.com', '_blank', 'width=400px,height=500px,menubar=no,toolbar=no')

                        }

                        else{

                                alert("再见");

                            }

                }

                else {

                    alert("再见!");

                }

     

            }

        

      </script> 

     </head> 

     <body> 

     <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 

     </body>

    </html>