JSP关闭触发事件,当点关闭页面按钮触发JS函数、事件

学习分享必看:javacto.taobao.com

//第一种方法

window.onbeforeunload = function() {
    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 = btn_exit();
     }
}

//第二种方法

window.onbeforeunload = onbeforeunload_handler;         
 function onbeforeunload_handler()
 {            
    btn_exit();         
}
 

猜你喜欢

转载自blog.csdn.net/zengzhaowu313/article/details/8989304