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

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

 

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

原文地址:https://www.cnblogs.com/jkswjw/p/1247990.html