onbeforeunload事件中 怎样捕捉cancel事件
如题
------解决方案--------------------
以上我的发表时错误的,刚试了下,能停止关闭的操作(以前的ie版本好像不能)
<script language="JavaScript">
window.onbeforeunload = function(){return false;}
</script>
------解决方案--------------------
<script language="JavaScript">
/**
* Event 'onUnloadCancel' capture
* By EtherDream
*/
window.onbeforeunload = function()
{
setTimeout(function(){setTimeout(onunloadcancel, 0)}, 0);
return "真的离开?";
}
window.onunloadcancel = function()
{
alert("取消离开");
}
</script>