您的位置:首页 > Web前端 > JavaScript

在A窗口中打开B窗口,在B窗口中操作完以后关闭B窗口,同时自动刷新A窗口

2011-04-19 17:45 501 查看
function closeWin() {
        hasClosed = true;

        var frame=window.opener.parent.document.frames.item('mainFrame')
    if(null != frame)
        window.opener.parent.document.frames.item('mainFrame').location.href = window.opener.location.href;
    }else{
        window.opener.location = "javascript:reloadPage();";
    }
        //window.opener.top.mainFrame.location="javascript:reloadPage();";
        //self.opener.frames.mainFrame.location.reload(true);
        window.opener = null;
        window.close();
    }
function window.onbeforeunload(){
        if (!hasClosed) {

        var frame=window.opener.parent.document.frames.item('mainFrame')

        f(null != frame){
            window.opener.parent.document.frames.item('mainFrame').location.href = window.opener.location.href;
        }else{
            window.opener.location = "javascript:reloadPage();";
        }
            window.opener = null;
        }
    }

function reloadPage() {
        history.go(0);
        document.execCommand("refresh")
        document.location = document.location;
        document.location.reload();
    }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  javascript function null