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

怎么错了?

怎么错了?

慕沐5961141 2016-07-26 13:15:51
 function openWindow(){              var a=confirm("确定打开吗");                if(a==true){           // document.write("banruili");            windows.open(' http://www.imooc.com/','_blank','width=400,height=500');            }else{                // document.write("banrui");              windows.close();             }  } 
查看完整描述

4 回答

?
小新在编程

TA贡献15条经验 获得超10个赞

<!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 a=confirm("确定打开吗");
        //confirm()会弹出一个对话框,点击确定会返回true, 取消返回false,直接可以把a放在if()里,不用再做判断
        if(a){
           // document.write("banruili");
            window.open('http://www.imooc.com/','_blank','width=400,height=500');
            }else{
                // document.write("banrui");
              windows.close(); 
            }
  } 
 
</script> 
</head> 
<body> 
  <input type="button" value="新窗口打开网站" onclick="openWindow()" /> 
</body>
</html>

编程的时候注意英文中文标点符号,中文标点符号会出错的;

第二window.oepn,不是windows.open,没有这个;

第三,编程在sublime3或者Dreamweaver下编程,这样错误要好找一些

查看完整回答
反对 回复 2016-07-27
?
韩显成

TA贡献4条经验 获得超5个赞

windows.open(' http://www.imooc.com/','_blank','width=400,height=500');//http后面的“:”也是中文的

查看完整回答
反对 回复 2016-07-26
?
Genment

TA贡献43条经验 获得超25个赞

if(a==true)// 这里的括号你写的是中文的括号
if(a==true) // 才对


查看完整回答
反对 回复 2016-07-26
  • 4 回答
  • 0 关注
  • 1551 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信