在云那方

首页 新随笔 联系 订阅 管理

 

window.onbeforeunload   =   function()   
{   
      var   n   
=   window.event.screenX   -   window.screenLeft;   
      var   b   
=   n   >   document.documentElement.scrollWidth-20;   
      
if(b   &&   window.event.clientY   <   0   ||   window.event.altKey)   
      {   
          alert(
"是关闭而非刷新");   
          window.
event.returnValue   =   "";     //这里可以放置你想做的操作代码   
      }else{
             alert(
"是刷新而非关闭");   
     }   
}  

 

posted on 2008-07-04 14:53  Rich.T  阅读(280)  评论(0编辑  收藏  举报