捕捉IE关闭按钮事件

<html>
  <head>
    <title>捕捉IE关闭按钮事件</title>
    <SCRIPT language=javascript>
      window.onbeforeunload = function(){
        var n = window.event.screenX - window.screenLeft;
        var b = n > document.documentElement.scrollWidth-20;
        var number=0;
        if (b && window.event.clientY < 0 || window.event.altKey)
        {   
          if(number<15){
            window.event.returnValue = "此时将关闭窗口!您确定吗?";  
          }
        }
     }
    </SCRIPT>
  <head>
  <body>
      nothing.....
  </body>
</html>

 

你可能感兴趣的:(JavaScript,html,IE,关闭,屏蔽IE关闭)