何判断窗口是关闭还是刷新

<script language=javascript>

function myunload()
{
if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey)
{
window.event.returnValue = "关闭窗口";
}
else{
window.event.returnValue = "刷新窗口";
}
}

</script>

 
如果用的是窗架集frameset,那么要在frameset里面写onbeforeunload事件,此时document.body.clientWidth要减去20

你可能感兴趣的:(JavaScript)