日期:2014-05-17  浏览次数:20847 次

如何取得window.open打开窗口的返回值?
A文件如下:
<select   name= "brand "   onchange= "window.open( 'clxz.asp?brand= '+this.value, ' ', ' '); ">
<option> ==请选择== </option>
</select>
车类选择:
<input   name= "kind "   type= "text "   id= "kind "   size= "10 "   maxlength= "20 ">
产地:
<input   type= "text "   name= "textfield ">

B文件如下:
<!--#include   file= "../conn.asp "-->
<!--#include   file= "../inc/function.asp "-->
<html>
<head>
<title> 新车信息输入 </title>
</head>
<body>
    <%
    brand=Request.QueryString( "brand ")  
    set   rs=server.createobject( "adodb.recordset ")
rs.open "select   *   from   Abrand   where   brand= ' "&   brand   & " ' ",conn,1,1
  %>      
    <form   action= " "   method= "get ">
    <input   name= "kind "   type= "text "   id= "kind "   value= " <%=rs( "kind ")%> "/>
    <label>
      <input   name= "kind2 "   type= "text "   id= "kind2 "   value= " <%=rs( "kind ")%> "/>  
      <input   type= "submit "   name= "Submit "   value= "提交 ">
    </label>
    </form>
    <%      
    rs.close      
    %>
</body>
</html>

请问我应该如何做才能让B文件的两个文本域中的值返回到A文件的两个文本域中?谢谢。

------解决方案--------------------
可以用类似于
window.opener.document.FORM1.TEXT1.value = "ABCDEFG ";
之类的语句赋值,当然需要在A文件中指定form的name。
也可以在B文件中给window.returnValue赋值(比如用逗号分割的字符串),
A文件中用var returnVal = window.open( 'clxz.asp?brand= '+this.value, ' ', ' ');
来取得这个returnValue,然后用split从字符串取得数组后赋值。