onunload
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script type="text/javascript">
window.onunload=onunload_message;
function onunload_message(){
alert("您确定关闭该页面吗?");
}
</script>
</head>
<body>
<h1>我的第一个 JavaScript 程序</h1>
</body>
</html>
为什么我这段代码onunload没有效果