web 关闭事件捕捉

<script   type="text/javascript">
        function window.onbeforeunload() {
            if (event.clientX > document.body.clientWidth && event.clientY < 0 || event.altKey) {
                alert(1); window.open('http://www.google.com');

                //window.event.returnValue = "确定要退出本页吗?onbeforeunload";
            }  
            }
            function window.onunload() {
                if (event.clientX > document.body.clientWidth && event.clientY < 0 || event.altKey) {                     
                    //alert("欢迎下次再来!");
                    //window.location.href = "http://www.sina.com%22;//没用的
                }
            }
    </script>

posted on 2009-12-08 16:02  http  阅读(184)  评论(0)    收藏  举报

导航