-2
window.onbeforeunload/window.onunload不工作在铬检测浏览器关闭事件。需要一些帮助!检测浏览器关闭在jquery/JavaScript跨浏览器
window.onbeforeunload/window.onunload不工作在铬检测浏览器关闭事件。需要一些帮助!检测浏览器关闭在jquery/JavaScript跨浏览器
入住这 http://help.dottoro.com/ljhtbtum.php
例如 http://help.dottoro.com/external/examples/ljhtbtum/onbeforeunload_1.htm
代码
<head>
<script type="text/javascript">
function OnBeforeUnLoad() {
return "All data that you have entered will be lost!";
}
</script>
</head>
<body onbeforeunload="return OnBeforeUnLoad()">
<b>Close this window or press F5 to reload the page.</b>
<br /><br />
<form>
User name: <input type="text" name="username" />
<br />
City: <input type="text" name="city" />
</form>
</body>
需要一些代码! – Bergi 2013-02-18 10:45:19