看不出来我哪儿错了啊 求大神帮忙啊

来源:2-7 编程练习

别说你没认真

2015-12-28 00:13

<!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 mis=prompt("你确定要打开网站吗?","http//www.baidu.com");

          if(mis!=null)

              {window.open(mis,"_blank",'width=400px,height=500px,menubar=no,toolbar=no');}

          

          else

          {alert("再见");}

  </script> 

 </head> 

 <body> 

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

 </body>

</html>


写回答 关注

2回答

  • ayundan
    2015-12-29 10:00:30

    修改后:

    <!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 mis=prompt("你确定要打开网站吗?","http://www.baidu.com");

              if(mis!=null)

                  {window.open('http://www.baidu.com',"_blank",'width=400px,height=500px,menubar=no,toolbar=no,scrollbars=yes');}

              

              else

              {alert("再见");}

    }

    }

      </script> 

     </head> 

     <body> 

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

     </body>

    </html>


  • 冰镇甜豆浆1
    2015-12-28 01:18:32

     function openWindow()

         { var message=confirm("是否打开?");

          if(message==true)

             { var mis=prompt("你确定要打开网站吗?","http//www.baidu.com");

              if(mis!=null)

                  {window.open(mis,'_blank','width=400px,height=500px,menubar=no,toolbar=no');}

    }

              else

              {alert("再见");}

    }

      {}  大括号括的地方不对。。。

         { var message=confirm("是否打开?");     这一行最后的分号应该是英文的; 你用的中文

    "_blank" 这么写不知道对不对 前面教的是'blank'

    别说你没认真

    十分感谢

    2015-12-28 13:46:59

    共 1 条回复 >

JavaScript入门篇

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

738661 学习 · 9561 问题

查看课程

相似问题