我想实现用户退出浏览器后就提醒一下,(不是离开这个网页)
有什么方法吗?

解决方案 »

  1.   

    <body onunload="alert('The onunload event was triggered')">
    </body>
      

  2.   

    <script type="text/javascript">
    window.onbeforeunload = function () {
    //IE || FF
    if( event.clientY   < 0||event.altKey)
    alert("点了关闭了。。");
    };
    </script>
      

  3.   

    window.onbeforeunload = function()   
    {   
      var n = window.event.screenX - window.screenLeft;   
      var b = n > document.documentElement.scrollWidth-20;   
      if(b && window.event.clientY < 0 || window.event.altKey)   
      {   
      alert("是关闭而非刷新");   
      window.event.returnValue = "";   
      }else   
      {   
      alert("是刷新而非关闭");   
      }   
    }