javascript中刷新时不触发页面的关闭事件

有时在页面的刷新会触发 window.onbeforeunload()事件,只要加一个判断就可以了。

 

function   window.onbeforeunload()  
  {  
  if   (event.clientX>document.body.clientWidth   &&   event.clientY<0||event.altKey){  
      window.event.returnValue="确定要退出本页吗?";  
  }

posted on 2008-07-21 21:40  梦回西夏  阅读(1090)  评论(0编辑  收藏  举报