<!DOCTYPE?HTML>
<html>
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8">
<title>?卸載事件?</title>
<script?type="text/javascript">???
?????window.onunload?=?onunload_message();???
?????function?onunload_message(){???
????????alert("您確定離開該網頁嗎?");???
????}???
</script>???
</head>
<body?>
??歡迎學習JavaScript。
</body>
</html>
onunload為什么只有在刷新和加載的時候調用
qq_為愛逆戰_0
2016-06-30 11:30:18