有A,B两个页面,A页面中包含很多信息,其中一个输入项要求从弹出窗口中选择,现在A窗口中有一个textbox和一个button,B页面用listbox列出了大量的选择项, 现在希望选择B中的一项后关闭B页面,同时将值写入A页面的textbox中。 同时不影响A页面中其他项的内容。 我该如何做?
请各位兄弟帮忙。

解决方案 »

  1.   

    Response.Write("<script>opener.document.form1.textbox1.value=B页面被选中的值"';window.close();</script>");
      

  2.   

    子页面:
    this.Response.Write("<script>window.opener.document.Form1.ICPID.value="+t+";window.close();</script>");
    opener.document.Form1.ICPID.value:父页面的Textbox
      

  3.   

    可以用模态弹出窗口实现,attribute_set2.aspx就是弹出的页面
    var a=window.showModalDialog ("attribute_set2.aspx?id8="+classid+"&val="+str3+"", my_friends,"scroll:1;status:0;help:0;resizable:1;dialogWidth:370px;dialogHeight:340px");
    if (a !="undefined")
    {
    document.Form1.Hidden8.value ="1";//返回值的标志
    document.Form1.Hidden5.value=a; //返回值
    }
      

  4.   

    A:
    <HTML><BODY>
    <input type="text" id="txt" size=20>
    <script>
    function show(){
    x = showModalDialog("test2.html");
    txt.value = x;
    }
    </script>
    <input type=button value=open onclick="show()">
    </BODY></HTML>
    B:
    <HTML><BODY>
    <input type="text" name="mm">
    <button onclick="doSomething()">do somthing</button>
    <script>
    function doSomething(){
      returnValue = mm.value;
      close();
    }
    </script>
    </BODY></HTML>
      

  5.   

    楼上的兄弟们, 我用了这种方法
    Response.Write("<script>window.opener.document.form1.dwmc.Text ='" + Label1.Text + "';window.close();")
    其中dwmc是父页面的textbox ,label1是弹出窗口的标签。 可运行的时候出现下面错误。错误:window.opener.document.form1.dwmc为空或不是对象。这是什么原因??
      

  6.   

    Response.Write("<script>window.opener.document.form1.dwmc.value ='" + Label1.Text + "';window.close();")
    是value不是Text
      

  7.   

    window.opener.document.form1.dwmc.value
      

  8.   

    opener就可以访问父页的函数和对象,用模态窗口页可以直接返回值的,具体看DHTML手册。
      

  9.   

    showModalDialog靠returnValue返回值,open出的窗口靠opener.document
      

  10.   

    我改成value还是报那个错误,  两个页面上有什么要求吗? B页面是点一个按钮执行这句话的。
      

  11.   

    看看打开B页时,使用的是open,还是showModalDialog如果是后者那么window.opener就是null
      

  12.   

    我用的是openResponse.Write("<script>window.open('b.aspx'" + ",'','toolbar=no,menubar=no,titlebar=yes,directories=no,resizable=no,status=yes,fullscreen=no,top=100;left=100,width=420,height=500');</script>")
      

  13.   

    是按钮退出么? 要是的话:写在后台
    B:
    string err = Server.UrlEncode('"+listbox.SelectValue+"');
    Server.Transfer("WebForm1.aspx?msg="+err);
    A:
    TextBox.Text = Request.QueryString["msg"].ToString();