首页 > 网站 > WEB开发 > 正文

javascript捕获窗口关闭事件

2024-04-27 14:02:06
字体:
来源:转载
供稿:网友

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

循环多次

if (event.clientY<0||event.altKey){
     window.event.returnValue="";
 }
else{
    
}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表