js监听浏览器关闭

<script type="text/javascript">  

window.onbeforeunload = onbeforeunload_handler;
function onbeforeunload_handler(){  
               var n = window.event.screenX - window.screenLeft;    
               var b = n > document.documentElement.scrollWidth-20; 
               
               if(b && window.event.clientY < 0 || window.event.altKey)    {    
$.get("login.do?method=logoff&t="+new Date(), null, null); 
               }else if(event.clientY > document.body.clientHeight){           
$.get("login.do?method=logoff&t="+new Date(), null, null);       
           }

            }  
</script>

(全文完)

(转载本站文章请注明作者和出处 js监听浏览器关闭