<html> <body> <script> //对于IE浏览器通过onbeforeunload事件可以很好的捕获控制 window.onbeforeunload = function(){ if(document.all){ var n = window.event.screenX - window.screenLeft; var b = n > document.documentElement.scrollWidth-20; if(b || window.event.clientY < 0 || window.event.altKey){ //function 调用自己要处理的方法 alert(1); } } } //对于火狐浏览器通过onunload事件捕获控制 window.onunload = function(){ if(!document.all){ if(document.documentElement.scrollWidth==0){ //function 调用自己要处理的方法 alert(2); } } } </script> </body> </html>
IE火狐关闭浏览器事件
猜你喜欢
转载自lncdzh.iteye.com/blog/2299753
今日推荐
周排行