B/S结构的程序,我想在一个页面上点击某个按钮打开另一个窗口,然后选择项目,点击确定将选择项目的值传回到原先的页面,请问如何实现?

解决方案 »

  1.   

    类似 
    http://www.aspxboy.com/private/showthread.asp?threadid=623
      

  2.   

    javascript就能实现。window.opener.form1.ddd.value="asdfasdfasdf";意思是在打开的窗体中给源窗体中的控件ddd值
      

  3.   

    1.用session.,比如传个int i值,
    原页面
    Session["value"]=i;
    第二页面:
    i=int.Parse(Session["value"].ToString());2.使用http头传
    类似 http://uploadStreamfile.aspx?ProgramCode=<%=ProgramCode%>然后第二页
    page_load 中读出
    Request.QueryString["ProgramCode"];
      

  4.   

    用C#实现,调用javascript也行。但是具体父窗口和子窗口中的控件,最好能给出代码例子。
      

  5.   

    有以下几种方法:
    1:JS
    2:URL
    3:session
    4:ViewState
      

  6.   

    a.htm
    <html>
    <head>
    <title>shop</title>
    <link REL="stylesheet" TYPE="text/css" HREF="../../../EbizResourceSet/css/default.css">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body>
    <FORM METHOD=POST ACTION="" name="area">
      <input type="text" name="fonttxt" value=''>
    <input type="text" name="fonttxt123123" value=''>
      <input name="button" type="button" class="buttonPop" onClick="openurl();" value="??8?">
       <script language="JavaScript">
    <!--
    function openurl(){
    window.open("b.htm",'Win','width=200,height=300');
    }
    //-->
    </script>
    </FORM></body>
    </html>
      

  7.   

    b.htm
    <html>
    <head>
    <title>SHOP</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    </head>
    <body TOPMARGIN="0" LEFTMARGIN="0" ALIGN="CENTER">
    <script language="JavaScript">
    <!--
    function closewin(page){
    window.opener.area.fonttxt.value=page;
    window.close();
    }
    //-->
    </script>
    <table width="53%" border="0" align="center" cellpadding="3" cellspacing="0">
      <tr> 
        <td align="center"><a href=# onClick="closewin('index1.htm');">电脑书籍 </a> 
        </td>
      </tr>
      <tr> 
        <td align="center"><a href=# onClick="closewin('index2.htm');" >电脑书籍 </a> 
        </td>
      </tr>
    </table>
    </body>
    </html>以前收藏的。
      

  8.   

    打开窗口也是用的window.open();我现在用window.opener.txt1.value="dd";
    加上这句就出现错误。原窗口明明有<input type="text" id="txt1" name="txt1"/>
    原因应该是没有找到txt1控件,不知道为什么
      

  9.   

    主页面 
        var returnValue = window.showModalDialog("url",'','dialogWidth:650px;dialogHeight:550px');
        if(returnValue != false && typeof(returnValue) != "undefined")
        {
             //returnValue 就是返回的值,可以是string,也可以是数组;
         }
    弹出页面
        window.returnValue = "string";//你所要返回的东西;
      

  10.   

    注意。window.opener.area.fonttxt.value=page;
    不是window.opener.fonttxt.value=page;