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

为什么无法运行

<!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 opentag=confirm("是否在新窗口打开网站?");

     if(opentag==true)

     {

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

         if(webadress!=null);

         {

             window.open(webadess,"_blank',width=400,height=500,menubar=no,toolbar=no');

         }

         else 

         {alert("结束");}

     }

     else 

         {alert("结束");}

 }

    

  </script> 

 </head> 

 <body> 

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

 </body>

</html>


正在回答

4 回答

你这个。。。。唉!(1)var opentag=confirm("是否在新窗口打开网站?");最后的分号用的中文的分好,改成英文的.(2)window.open(webadess,"_blank',width=400,height=500,menubar=no,toolbar=no');的webadress写错了webadess,而且你这里面的引号用的不规范(3) if(webadress!=null);这句后面的分号去掉(4)<input type="button" value="新窗口打开网站" onclick="openWindow()" /> 你绑定的这个方法名字和你定义的不一样,要区分大小写的

1 回复 有任何疑惑可以回复我~

 window.open(webadess,"_blank',width=400,height=500,menubar=no,toolbar=no');

webadess写错了webadress

0 回复 有任何疑惑可以回复我~

去掉一个

else{alert("结束");}

0 回复 有任何疑惑可以回复我~

把两个else去掉。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
JavaScript入门篇
  • 参与学习       738222    人
  • 解答问题       9558    个

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

进入课程

为什么无法运行

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信