猿问

js捕捉状态栏的鼠标右键关闭

原因是:用户单击浏览器右上角的关闭按钮,我会给用户一个提示"您已关闭了浏览器'",但用户问我那我如果单击的是状态栏的鼠标右键并且是关闭,那能实现同样效果吗?我无语了

<script>
 function closeBrowse()
  {
   alert('您已关闭了浏览器');  
  }
 window.onload = closeBrowse
</script>

请大虾指教,不甚感激


沧海一幻觉
浏览 529回答 2
2回答

哆啦的时光机

<Script Language="JavaScript">function window.onunload(){&nbsp; //when close ie&nbsp; if(window.screenLeft==10004)&nbsp;&nbsp; {&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert("您已关闭了浏览器'");&nbsp;&nbsp;&nbsp;}&nbsp;}</Script>这个在ie6下没问题,其他的还没测过。&nbsp;在globa.asax里实现session end事件应该也可以

海绵宝宝撒

<script language="javascript">&nbsp;var s="close";function window.onunload(){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(s=="fresh")&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(window.screenLeft>10000){alert('关闭');}else{alert('刷新');}&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alert('关闭');}function window.onbeforeunload(){&nbsp;&nbsp; s="fresh";}</script>
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答