页面离开时的 javascript事件
<html>
<head>
<script>
function window.onunload()
{
if(window.confirm("你要关闭吗?"))
{return 2}
}
</script>
</head>
<body >
<input type="text">
<script>
function window.onunload()
{
if(window.confirm("你要关闭吗?"))
{return 2}
}
</script>
</body>
</html>
2
<body onbeforeunload="return '要提示的内容'">