zoukankan      html  css  js  c++  java
  • 在两个页面之间互相写其控件内的值

    定义A页面,定义TextBox id="TextBox1"和Button id="Button1"
    后台代码:

    private void Page_Load(object sender, System.EventArgs e)
            
    {
                
    this.Button1.Attributes.Add("onclick","window.open('SelectData.aspx?rec=TextBox1','newwin','toolbar=no,menubar=no,status=no,location=no,resizable=no,scrollbars=no,width=218,height=185,top=190,left=300');return false;");
            }

    定义界面B:  TextBox id="TextBox1"和Button id="Button1" 和type="hidden" id="name"
    脚本:

    <SCRIPT language="JavaScript">
                
    var parwindow;
                parwindow
    =self.opener;
                
    var recv = document.all("name").value;
                
    if (parwindow != null
                
    {
                document.all(
    "TextBox1").value=parwindow.document.all(recv).value;
                }

                
                
    function changetext() 
                
    {
                    
    if (parwindow != null
                    
    {
                        
    try{
                                parwindow.document.all(recv).value 
    = document.all("TextBox1").value;
                            }

                        
    catch(e)
                            
    {
                            }

                     }

                }

            
    </SCRIPT>

    放在form后
    后台代码:

    private void Page_Load(object sender, System.EventArgs e)
            
    {
                name.Value 
    = Request.QueryString[0];
                
    this.Button1.Attributes.Add("onclick","changetext();window.close()");
            }


     


     

  • 相关阅读:
    数据类型
    一些骚操作
    re
    多任务
    监听按钮点击事件
    监听按钮点击事件
    监听按钮点击事件
    将博客搬至博客园
    将博客搬至博客园
    将博客搬至博客园
  • 原文地址:https://www.cnblogs.com/xh831213/p/331687.html
Copyright © 2011-2022 走看看