父窗体 点击按钮,子窗体弹出。
子窗体进行数据更新操作,
操作完毕后,子窗体关闭,父窗体自动刷新。
例如:QQ好友买卖:  折磨奴隶时,会弹出子窗体。数据更新操作后,子窗体关闭。父窗体自动刷新。

解决方案 »

  1.   

    有几种方法可以实现,可以采用ajax达到这样的效果
    还有一种就是用JS实现,如下面parent.htm页面  程序代码
    <script language="JavaScript">
    <!--
    function cd()
    {
        win=window.open("son.htm","win","width=200,height=200");
    }
    //-->
    </script>
    <input type="button" value=" 子页面" onclick="cd();">
    <p>
    <input type="text" name="">son.htm页面  程序代码
    <title>子页面</title>
    <script language="JavaScript">
    <!--
    function reflesh()

        window.opener.opener=null; window.opener.location.reload();  //实现父窗体刷新
        //window.opener.opener=null; window.opener.navigate(’parent.htm’); //实现父窗体重新加载
    }
    //-->
    </script>
    <input type="button" value="刷新" onclick="reflesh();"> 
      

  2.   

    直接ajax就可以实现局部更新了
      

  3.   

    open.jsp加入
    <%
    String success1 = (String)request.getAttribute("success1");
    if(success1 != null){
    %>
    alert('<%=success1%>');
    window.returnValue = 1;
    window.close();
    <%
    }
    %>main.jsp  
    function a(){ var flag = window.showModalDialog('open.jsp',window,'resizable:yes;scroll:yes;status:no;dialogWidth=600px;dialogHeight=600px;center=yes;help=no');
    if(flag == 1){
    document.location.href = document.location.href;
    }
    }
      

  4.   

    对于用window.open()打开的子窗口,可以用widow.opener.jsmethod()调用父窗口的JS函数;
    如果是用模式窗体window.showModalDialog打开的子窗口,可以在父窗口中获得子窗口关闭后的返回值再进行相应的操作。