问答详情
源自:2-6 JavaScript-关闭窗口(window.close)

帮忙看下哪错了,点击后没反应,谢谢!!!

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>close()</title>
  <script type="text/javascript">
       function ahou(){
           var mywin=window.open("http://www.imooc.com");
      var win=confirm("guan?");
      if(win==ture){
        mywin.close();  }
        else{alert("不关");}
        }
  </script>
</head>
<body>
<input type="button" name="button" value="are you sure?" onClick="ahou"/>
</body>
</html>

提问者:Lgpink 2016-01-09 00:38

个回答

  • 百态人生
    2016-01-09 01:11:23
    已采纳

    函数没有调用,少了括号--->onclick="ahou()"

    if语句里的true写错了