给你个简单的例子:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 4</title>
</head>
<body onload="alert('This is onload event!');" onunload="alert('This is onunload event!');">
</body>
</html>
你可以把相关事件中的代码换成你自己的函数或者代码。
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 4</title>
</head>
<body onload="alert('This is onload event!');" onunload="alert('This is onunload event!');">
</body>
</html>
你可以把相关事件中的代码换成你自己的函数或者代码。
对话框,但这个页面却已经关闭了,有没有办法在onunload函数里面用代码取消这个事件,让该页面不关闭(不能调用系统的对话框)
因onunload就是当页面关闭时才触发的事件!你想触发这个事件后,页面不关闭是吗?