如果只是输入一些信息,用javascript中的prompt应该可以吧。如果一定要一个页面的话,你只有A->B->A也就是要刷新A页因为A页面显示完后,就是一个静态页面,在不刷新时只能用javascript来控制

解决方案 »

  1.   

    要实现此功能最好使用带有返回值的showModalDialog如下
    在"选择人员"的onclick="msg()"
    function msg()
    {
    var str
       str=window.showModalDialog("select.jsp")//str为返回的值
    document.form1.name.value=str//把得到的给name
    }
    在select.jsp中
    function ok()
    {var b="" b=document.form1.select2.value
    //b=document.form1.select2.text window.returnValue=b
     window.close()
    }
    function cancel()
    {window.returnValue=""
    window.close()}
    <input type="button" name="gg" value="确定" onclick="ok()">
    &nbsp;&nbsp;&nbsp;&nbsp
    <input type="button" name="can" value="取消" onclick="cancel()">
      

  2.   

    我想理论上是可以的在B页面中填入的东西,可以存放在服务器端的session中,在b页面关闭的时候,让服务器将A页面刷新,并将session中内容填入A页面
      

  3.   

    两种方法:
    1 打开模态窗口,获取返回值,用脚本填充主窗口相关域。优点:窗口联系层次分明,缺点:跳转翻页等实现起来痛苦,返回值只能是一个字符串,对于回填多个域要另做字符串的合并与拆解实现。
    2 打开非模态窗口,在子窗口关闭前,直接用window.opener来引用源窗口的域并填充值。优点:实现翻页,跳转非常方便,无需特别控制。而且易填充多个域。缺点:与源窗口的联系相对弱,一旦用户切换源窗口控制难。举例:parent.html中的中有一form,其中dept栏须用帮助窗口来辅助输入。用两个按钮分别来演示模态窗口实现和非模态窗口实现:
    <!--parent.html-->
    <html>
    <head>
    <script>
    function getForce(){
     var sRtn
     sRtn = window.showModalDialog("help1.html")
     form1.dept.value=sRtn
    }
    function getFree(){
     window.open("help2.html")
    }
    </script>
    </head>
    <body>
    <form name="form1">
    请输入部门名称:<input value="" readonly name="dept" type="text" >
    <br>
    <input type=button name="强制输入" value="force" onclick="getForce()">
    <input type=button name="自由输入" value="free" onclick="getFree()">
    </form></body>
    <html><!--help1.html-->
    <html>
    <head>
    <script>
    function returnWithValue(s){
     window.returnValue=s
     window.close()
    }
    </script>
    </head>
    <body>
    <table>
    <tr bgcolor='#cccccc'>
    <td>编码</td>
    <td>单位名称</td>
    </tr>
    <tr onclick="tmp.value='单位1'" ondblclick="this.onclick;ok.click()">
    <td>111</td>
    <td>单位1</td>
    </tr>
    <tr onclick="tmp.value='单位2'" ondblclick="this.onclick;ok.click()">
    <td>222</td>
    <td>单位2</td>
    </tr>
    </table>
    <input type="hidden" value="" name="tmp"><input type=button name="ok" value="确定" onclick="returnWithValue(tmp.value)">
    <input type=button name="cancel" value="取消" onclick="returnWithValue('')">
    </form></body>
    <html>
    <!--help2.html-->
    <html>
    <head>
    <script>
    function returnWithValue(s){
     var winSource= window.opener
     
     winSource.form1.dept.value=s
     window.close()
    }
    </script>
    </head><body><table>
    <tr bgcolor='#cccccc'>
    <td>编码</td>
    <td>单位名称</td>
    </tr>
    <tr onclick="tmp.value='单位1'"  ondblclick="this.onclick;ok.click()">
    <td>111</td>
    <td>单位1</td>
    </tr>
    <tr onclick="tmp.value='单位2'" ondblclick="this.onclick;ok.click()">
    <td>222</td>
    <td>单位2</td>
    </tr>
    </table>
    <input type="hidden" value="" name="tmp"><input type=button name="ok" value="确定" onclick="returnWithValue(tmp.value)">
    <input type=button name="cancel" value="取消" onclick="returnWithValue('')">
    </body>
    <html>