jquery或者JS【关闭窗口触发】

2025-05-12 22:43:15
推荐回答(3个)
回答(1):

window.onbeforeunload = function close()
{ temp=0;
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 = "退出登录?"; //这里可以放置你想做的操作代码
temp=1;
}

}

回答(2):

window.close();

回答(3):

$(window).unload(function () {
alert("关闭");
})