方法一:
方法二:
方法三:
[/code]<script>
window.onbeforeunload = function()
{
if (document.body.offsetWidth-50 < event.clientX && event.clientY<0)
return alert("你点击了关闭按钮");
}
</script>
方法二:
<script>
function window.onunload(){alert(这就是你要做的事,关闭网页之后做的!)}
function window.onbeforeunload(){alert(这就是你要做的事,关闭网页之前做的!)}
</script>
方法三:
<script>
function tuichu(){alert(这就是你要做的事,关闭网页之后做的!)}
function tuichuqian(){alert(这就是你要做的事,关闭网页之前做的!)}
</script>
<body onunload="tuichu()" onbeforeunload="tuichuqian()">