parent:
var mm = showModalDialog('ttt.htm', window,'dialogWidth: 480px; dialogHeight: 360px; status: no; help: no');
//注意第二个参数, 是 window 对象mode:
var parentWin = window.dialogArguments; //得到主页面的window对象parentWin.varName = "mm";
parentWin.document.formName.inputName.value = "mm";
parentWin.document.all.objId.innerText = "mm";
......

解决方案 »

  1.   

    a.htm
    -----------------
    <input name=aaa><input type=button vlaue=test onclick="testFun();">
    <script language=javascript >
    function testFun()
    {
    var dateValueFromdialog=showModalDialog("b.htm",document.all.aaa,"scrollbars:no;status:no;");
    if(dateValueFromdialog!=null)
    {
    document.all.aaa.value=dateValueFromdialog;
    }
    }
    </script>
    b.htm
    --------------------<script language=javascript>window.returnValue="abcde";
    window.close();//也可以通过传来的参数(document.all.aaa),直接对传来的参数赋值:
    //window.dialogArguments.value="abcde";
    </script>
      

  2.   

    ss.htm
    -------------------------------------------------
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    <script language="JavaScript">
    function openpage()
    {
       var a = window.showModalDialog("aa.htm",window,"dialogwidth:500px;dialogheight:150px;status:no;scroll:no");
    }
    </script>
    </head><body><form name="form1" method="post" action="">
    <table width="500" border="1">
      <tr>
        <td><input name="ParentOID" type="text" id="ParentOID" value="默认的值"></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><input type="button" name="Submit" value="弹出" onClick="openpage()"></td>
      </tr>
    </table>
      </form>
    </body>
    </html>
    ------------------------------------------------
    aa.htm<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>模态窗口</title>
    <script language="JavaScript">
    //得到父窗口的引用。
    var VarObject = window.dialogArguments;
    //刷新父窗口
    function ReferParentWin()
    {
        if(VarObject != null){
    //刷新父窗体.
    VarObject.location.reload();
         }
    }
    function ListValue()
    {
      document.all["ChildOID1"].value = VarObject.document.all["ParentOID"].value
    }
    function GetValue()
    {
      VarObject.document.all["ParentOID"].value = document.all["ChildOID2"].value
    }
    </script>
    </head><body>
    <table width="500" border="1">
      <tr>
        <td>
            <input type="submit" name="Submit" value="赋值" onClick="ListValue()">
          <input type="submit" name="Submit3" value="给父窗体内的文本赋值" onClick="GetValue()">
          <input type="submit" name="Submit2" value="刷新父窗口" onClick="ReferParentWin()"> 
        </td>
      </tr>
      <tr>
        <td>
          <input name="ChildOID1" type="text" id="ChildOID1">
          <input name="ChildOID2" type="text" id="ChildOID2" value="赋给父窗口的值"> </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>
    </body>
    </html>
    运行 ss.htm