问题如下:
  调用window.onbeforeunload事件,点击翻页事件时,弹出2次窗口?如何解决此类问题?不吝请教高手解答!!!!

解决方案 »

  1.   

    /*
            判断视频页面是刷新还是关闭
            */
            window.onbeforeunload = function checkLeave(e) {
            //function CloseWindow() {
                //document.body.clientWidth                 当前网页
                //window.parent.frames['ldy'].clientWidth   框架网页
                if (screen.width > window.parent.frames['ldy'].clientWidth && event.clientY < 0 || event.altKey) {
                    if (OpenVideoCount > 0) {
                        window.event.returnValue = "---------------------------------------------------------------------\n网页上还有" + OpenVideoCount + "个视频监控在运行,关闭页面这些视频将会被关闭,确定关闭页面?\n---------------------------------------------------------------------";
                        vTF = true;
                    }            } else {
                    if (OpenVideoCount > 0) { 
                        //document.getElementById("txtSearch").focus();
                        window.event.returnValue = "---------------------------------------------------------------------\n网页上还有" + OpenVideoCount + "个视频监控在运行,刷新页面这些视频将会被关闭,确定刷新页面?\n---------------------------------------------------------------------";
                        vTF = true;
                    }
                }
            }
    以上就是我的代码,点击其他的执行后台事件时没有问题,只是点击分页按钮执行后台事件才弹出2次????