想实现这样的功能:现有webA.aspx,webB.aspx两个页面,在webA中有一个TextBox,一个button,点击button后弹出webB,对webB操作以后会产生一些数据,现在想在关闭webB的时候将数据写入webA的textBox中,不知有什么方法? 

解决方案 »

  1.   

    用脚本把值传回来吧,"openr.document.textbox.value= " + string
      

  2.   

    如果是window.open(),只需要在子窗体上window.opener.document.getElementById("id").value=window.document.getElementById("id").value如果是window.showModalDialog(),则在父窗体里打开子窗体事情写 var mm = new Array();//用作参数传递
    mm=window.showModalDialog("wfSpdmfl.aspx",params,"dialogHeight:400px;dialogWidth:450px;edge:Sunken;center:Yes;help:No;resizable:No; status:No");
             if(mm != null)
    {  
    window.document.getElementById("id").value=mm[0];
    } 在子窗体的上写
    var ss=new Array();
    ss[0]=window.document.getElementById("id").value;
    window.returnValue=ss;
      

  3.   

    //用于弹出b页
    function ShowDialogArg(b页的url, width, height)
    {
    var sFeature = "dialogWidth:" + width + "px;dialogHeight:" + height + "px;resizable:no;scroll:yes;center:yes;help:no";
     return window.showModalDialog(url, window, sFeature);
    }
    //获取b页回传得数据
    function GetGoods()
    { var goodsName = ShowDialogArg('goodsselect.aspx',800,600);

      if(goodsName!=null)
      {
      document.getElementById("txt_goodsname").value=stringArr[0];     }

    }
    //
    <asp:textbox id="txt_goodsname" runat="server" ReadOnly="True" Width="217px">
    <INPUT onclick="javascript:GetGoods()" type="button">