更新记录后关闭子窗口并刷新父窗口

父窗口代码:
<a href="javascript:void(0)" onclick="window.open('child.html','child','width=400,height=300,left=200,top=200');">打开子窗口</a>

子窗口代码:


<script language="JavaScript" type="text/javascript">
<!--
function refreshParent()
{
    window.opener.location.href = window.opener.location.href;
    if (window.opener.progressWindow)
    {
        window.opener.progressWindow.close();
    }
    window.close();
}
//-->
</script>

<a href="javascript:void(0)" onclick="refreshParent()">刷新父窗口并关闭当前窗口</a>

    //关闭子窗口并刷新父窗口
                StringBuilder scriptString = new StringBuilder();//刷新父窗口
                scriptString.Append("<script language = javascript>");
                scriptString.Append("window.opener.location.href = window.opener.location.href;");//父窗刷新
                scriptString.Append("if (window.opener.progressWindow){ ");
                scriptString.Append("window.opener.progressWindow.close();} ");
                scriptString.Append(" window.close(); ");
                scriptString.Append("</script>");
                Response.Write(scriptString.ToString());

你可能感兴趣的:(更新)