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

来源:2-7 编程练习

慕粉4370907

2016-11-29 10:52

写回答 关注

3回答

  • 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>

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

    混世小魔王o... 回复慕粉4370...

    把你的代码 粘上来 我瞅瞅

    2016-11-29 14:23:46

    共 4 条回复 >

  • 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>


JavaScript入门篇

JavaScript做为一名Web工程师的必备技术,本教程让您快速入门

741114 学习 · 9865 问题

查看课程

相似问题