关闭窗口时会触发两个事件: onbeforeunload onunload
不过在刷新页面的时候这两个事件也会被触发, 所以你自己要加以判断:
<script language=javascript>
window.onbeforeunload = function()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
alert("这里写上你想做的事");
}
}
</script>
不过在刷新页面的时候这两个事件也会被触发, 所以你自己要加以判断:
<script language=javascript>
window.onbeforeunload = function()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
alert("这里写上你想做的事");
}
}
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货