问答详情
源自: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">

    var mywin=window.open("http://www.imooc.com","_blank",width=200,height=200,top=10,left=0);

      function rec(){

      var guanbi=comfirm("你是否关闭此窗口?");

      if (guanbi==ture)

      {

        mywin.close();

        document.write("窗口关闭!");

      }

      else{

         document.write("窗口未关闭!");

      }

     }

  </script>

</head>

<body>

     <input name="button" type="button" onClick="rec()" value="点击我,弹出确认对话框" />

</body>

</html>


提问者:上元琦梦 2018-09-19 15:30

个回答