<script language="javascript">
window.onbeforeunload = function()
{   
      if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)   
      {   
          window.event.returnValue="确定要退出本页吗?";   
      }else   {   
          alert("你在刷新")   
      }   
  }
</script>

解决方案 »

  1.   

    <script language="javascript">
    window.onbeforeunload = function()  //author: meizz
    {
      var n = window.event.screenX - window.screenLeft;
      var b = n > document.documentElement.scrollWidth-20;
      if(b && window.event.clientY < 0 || window.event.altKey)
      {
        window.event.returnValue = "";  //这里可以放置你想做的操作代码
      }
    }
    </script>
      

  2.   

    meizz测试有效 不过通过文件-〉关闭没法响应
    wasuka测试无效 仍然谢谢马上揭帖