我想让子窗口给父窗口传两个参数,分别赋值给父窗口的两个textbox,请问如何实现?

解决方案 »

  1.   

    a.htm: 
    <SCRIPT language="javascript"> 
    <!-- 
    function OpenWin() 

    var getv = showModalDialog("eg.htm", "egwin", "dialogWidth:420px; dialogHeight:220px;status:no;help:yes"); 
    if (getv != null) 

    TextInfo.value=getv.split(",")[0];; 
    aa.value=getv.split(",")[1];; 

    } //--> 
    </SCRIPT> 
    </head> 
    <input type="text" name="TextInfo"> 
    <input type="text" name="aa"> 
    <input type="button" name="Submit" value="打开" onClick="OpenWin()"> b.htm: 
    <SCRIPT language="javascript"> 
    <!-- 
    function GetValue() 

    window.returnValue=TextName.value+","+aa.value; 
    window.close(); 
    } //--> 
    </SCRIPT> <input name="TextName" type="text" id="TextName" value="因为有你而精彩"> 
    <input name="aa" type="text" id="aa" value="MKLove"> 
    <input type="button" name="Submit" value="关闭" onClick="GetValue()"> 
    </p> 
    </div> 
    </body> 
    </html> 
      

  2.   

    可以在父窗口定义一个方法:
    internal void SetTextBoxValue(string str1, string str2)
    {
        this.textBox1.Text = str1;
        this.textBox2.Text = str2;
    }子窗体可以调用:
    this.MdiParent.SetTextBoxValue(...,...);
      

  3.   

    function openry()
        {
           var someValue=window.showModalDialog("Jigou.aspx")
           var ary = someValue.split("|");
           var mc = ary[0];
           var id = ary[1];
           //document.form1.TextBox6.value=someValue;
        } 
    Jigou.aspx:代码   
        protected void CategoryView_SelectedNodeChanged(object sender, EventArgs e)
        {
            string mc,id;
            mc = CategoryView.SelectedNode.Text.ToString();
             id = CategoryView.SelectedNode.Value.ToString();
            string s = mc+"|"+id;
           Response.Write("<script> window.returnValue='"+s+"'; window.close();</script>");
      }