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

为什么窗口打不开

<!DOCTYPE html>

<html>

 <head>

  <title> new document </title>  

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>   

  <script type="text/javascript">  

function openWindow() {

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

 var opentag=confirm("是否在新窗口打开网站?");

 if(opentag==true)

    {

      var webadress=("通过输入对话框,确定打开的网址","http://www.imooc.com");

  }

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

   if(webadress!=null)

  { 

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

  }

   else

   {alert("结束");}

   

   }

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

  else

{alert("结束");}

  

}





    

    

  </script> 

 </head> 

 <body> 

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

 </body>

</html>


正在回答

5 回答

你这大括号不多一个吗

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

只需要改成这样就行了: window.open(webadress,'_blank','width=400,height=500,menubar=no,toolbar=no');

我试过了,可以运行!

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

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

这行代码,你的单双引号,只能用一种,不能2种都在这语句中应用。

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


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

还是不可以

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

http://www.imooc.com/改成http://www.imooc.com/,冒号是英文的

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

举报

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

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

进入课程

为什么窗口打不开

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号