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

为啥不能打开新网页,哪里写错了么

<!DOCTYPE html>
<html>
 <head>
  <title> new document </title>  
  <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>   
  <script type="text/javascript">
  function kopen()
  {
      var c=confirm("确认打开新网站");
      if(c==ture))
       {
           var d=prompt("请输入你需要打开的网页:","http://www.imooc.com/");
           if(d==null)
           {
               document.write("真的不想打开么,再会!");
           }
           else
           {
               window.open(d,'_blank','width=400,height=500,menubar=no,toolbar=no');
           }
    // 新窗口打开时弹出确认框,是否打开
        
        }
        else{
            document.write("真的不想打开么,再会!");
    //打开的窗口要求,宽400像素,高500像素,无菜单栏、无工具栏。
        }
  }
    
   
    // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/
    
    
  </script>
 </head>
 <body>
      <input type="button" value="新窗口打开网站" onClick="kopen()"/>
 </body>
</html>

正在回答

4 回答

if的)多打了一个,prompt是输入框你后面已经给定URL了

0 回复 有任何疑惑可以回复我~
1、注意符号的完整性; 
2、注意中英文符号,如冒号、引号、括号
3、建议:注释应该卸载需要它的地方,不要乱写,这样不利用项目维护


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

if c==ture))那里有两个右括号

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

举报

0/150
提交
取消

为啥不能打开新网页,哪里写错了么

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