不懂哪里错了

<!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 message=confirm("是否打开新世界?");

        if(message=true)

            {

                var url;

                url=prompt("请输入你的ID","www.imooc.com/") 

                if(url=www.imooc.com/)

                {

                window.open(url,"_blank","toolbar=no, menubar=no, scrollbars=yes,  width=400, height=400");

                }

                else

                {alert("再见")}

            }

        else

            {alert("再见")}}

    // 新窗口打开时弹出确认框,是否打开


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


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

    

    

  </script> 

 </head> 

 <body> 

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

 </body>

</html>


Mrshoushou
浏览 1296回答 1
1回答

李晓健

<!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 message=confirm("是否打开新世界?"); //你这里写了中文分号         if(message=true)         {             var url;             url=prompt("请输入你的ID",/*你这里写了中文逗号,网址是http开头*/"http://www.imooc.com/")             if(url==='http://www.imooc.com/' /*这里字符串要加引号,判断相等是 == 或 === ,= 是赋值不是判断*/)             {                 window.open(url,"_blank","toolbar=no, menubar=no, scrollbars=yes,  width=400, height=400");             }             else             {alert("再见")}         }         else         {alert("再见")}}         // 新窗口打开时弹出确认框,是否打开         // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/         //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。     </script> </head> <body> <!--这里的方法名也写错了 w是小写--> <input type="button" value="新窗口打开网站" onclick="openwindow()" /> </body> </html>
打开App,查看更多内容
随时随地看视频慕课网APP