截获浏览器关闭消息

<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> 
posted @ 2008-06-17 11:56  my favorite  阅读(224)  评论(0)    收藏  举报