用window.returnValue,每个页面都有。

解决方案 »

  1.   

    To:  wcqgm(傲翔白鸽) 我用的就是用window.returnValue,但值传不过去,老出错。
      

  2.   

    an_array_c[0]=window.document.frm.a1.Value;是不是这行提示错,还是那一行呀如果是这行的话加一个this.window.document.frm.al.Value看看有没有什么反应
      

  3.   

    To: 52juanjuan(Fibona)加 this 也不行。
    提示缺少函数。
      

  4.   

    第一、在t2页面,window.returnValue = an_array_c; 而不是an_array_c(4);
    第二、在t2中应该能够接收t1的参数,因此,在t1页面应该新增一个数组:
    var an_array_to = new Array("","","","");
    在赋值后将showModalDialog的第二个参数设置为an_array_to
    在t2页面通过 var an_array_to = window.dialogArguments获取
      

  5.   

    搞了半天还未搞明白。
    t1的我已改为:
    <script language='javascript'> 
    function shows()
    {
      var a = window.showModalDialog("t2.php","a","dialogHeight: 300px; dialogWidth: 200px; dialogTop: 200px; dialogLeft: 300px; center: no; help: no; resizable:no; status:no");
      window.document.pfrm.T1.value=a[0]
      window.document.pfrm.T2.value=a[1]
      window.document.pfrm.T3.value=a[2]
      window.document.pfrm.T4.value=a[3]
    }
    </script>T2的改为:
    <script language='javascript'> 
    function okClick()
    {
      var a=new Array("","","","")
      a[0]=window.document.frm.a1.Value
      a[1]=window.document.frm.a2.Value
      a[2]=window.document.frm.a3.Value
      a[3]=window.document.frm.a4.Value
      window.returnValue = a
      window.close()
    }
    </script>关闭T2时,T1的各Text中的值均为:undefined;
    但如果将T2中的script更改为:
    function okClick()
    {
      var a=new Array("aa","bb","cc","dd")
      window.returnValue = a
      window.close()
    }
    </script>
    则可得到正确的值。
    错在哪儿了?
      

  6.   

    本机测试通过:
    t1.htm
    ----------------------------------------------------------------------------------
    <html>
    <head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=??????">
    <script language='javascript'> 
      //var an_array = new Array("abcde","abcdef","abcdefg","abcdefgh");
      function shows()
      {
        an_array = window.showModalDialog("t2.htm","Dialog","dialogHeight: 300px; dialogWidth: 200px; dialogTop: 200px; dialogLeft: 300px; center: no; help: no; resizable:no; status:no"); 
        pfrm.T1.value=an_array[0];
        pfrm.T2.value=an_array[1];
        pfrm.T3.value=an_array[2];
        pfrm.T4.value=an_array[3];
      }
    </script>
    <title>Page 1</title>
    </head><body><form method="POST" name="pfrm" action="aaa.php">
      <input type="text" name="T1" size="20" value=""></p>
      <input type="text" name="T2" size="20" value=""></p>
      <input type="text" name="T3" size="20" value=""></p>
      <input type="text" name="T4" size="20" value=""></p><input type="button" value="Add" onClick="shows()" class="bt">
      <p><input type="submit" value="提交" name="B1"></p>
      
      
      
      <input type="reset" value="重置" name="B2"></p>
    </form></body>
    </html>t2.htm
    ----------------------------------------------------------------------------------
    <html>
    <head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=??????">
    <script language='javascript'> 
      function okClick()
      { 
    var an_array_c = new Array();
        an_array_c[0]=frm.a1.value;
        an_array_c[1]=frm.a2.value;
        an_array_c[2]=frm.a3.value;
        an_array_c[3]=frm.a4.value;
        window.returnValue = an_array_c;
        window.close();
      }
    </script>
    <title>Page 2</title>
    </head><body><form name="frm">
      <input type="text" name="a1" size="20" Value="aa"></p>
      <input type="text" name="a2" size="20" Value="bb"></p>
      <input type="text" name="a3" size="20" Value="cc"></p>
      <input type="text" name="a4" size="20" Value="dd"></p><input type="button" value="?" onClick="okClick()" class="bt">
    </form></body></html>
      

  7.   

    多谢 stefli((桂电)):但为何不用加“window.document”。