<HTML>
<HEAD>
<title>test</title>
</HEAD>
<body onbeforeunload="RunOnBeforeUnload()" onunload="RunOnUnload()">
<script language="javascript">
function RunOnBeforeUnload() {
 window.event.returnValue = '关闭浏览器将退出系统.';
 //alert("before");
 }
function RunOnUnload() {
 //执行你的代码
 alert("good");
}
</script>
</body>
</HTML>


IE支持onbeforeunload和onunload
Firefox支持onnload
Safare和Opera不支持onbeforeunload和onunload
评论
发表评论

您还没有登录,请登录后发表评论

BIGN
  • 浏览: 52374 次
  • 性别: Icon_minigender_1
  • 来自: 远方的山边
  • 详细资料
搜索本博客
我的相册
D11df183-2b86-3c41-811f-336e641f7879-thumb
denglu
共 25 张
存档
最新评论