<html>
<head>
</head>
<script>
window.onload = test;
function test()
{
alert("ok");
}
</script>
<body>
</body>
</html>
刷新时就触发,缺点是第一次执行时也触发:P
<head>
</head>
<script>
window.onload = test;
function test()
{
alert("ok");
}
</script>
<body>
</body>
</html>
刷新时就触发,缺点是第一次执行时也触发:P
当刷新或关闭时,首先会触发onbeforeunload和onunload
假如按F5键刷新可以通过onkeypress事件来判断,但按IE按钮上的刷新按钮,则不知道该怎么弄了