zoukankan      html  css  js  c++  java
  • 弹出页面之间传值

    假如A页面需要弹出B页面,在比页面关闭时,A页面要拿到B页面的需要值;

    思路可以认为是:

    1.在A页面中利用Window.Open()方法;

    <body>
        <form id="form1" runat="server">
        <div>
             <asp:TextBox ID="txtTest" runat="server"></asp:TextBox>
            <input id="Button1" type="button" value="button" onclick="window.open('Default.aspx?', 'b', 'height=450, width=550, top=120, left=262, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')" />
      </div> </form> </body> </html>

     2.在弹出的B页面中取得相关值,赋给前台的Value;

    利用Window.Opener拿到弹出此页面的页面(父页面)中txtTest控件;

    然后赋值,关闭页面;

    <head runat="server">
        <title>无标题页</title>
        <script language="javascript" type="text/javascript">
            function fun()
            {
                var value=document.getElementById("txtValue").value;
                var txtObjId = window.opener.document.getElementById("txtTest");
                txtObjId.value = value;
                window.opener = null;
                window.close();
            }
    
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:TextBox ID="txtValue" runat="server"></asp:TextBox>
            <input id="Button1" type="button" value="关闭" onclick="fun()" /></div>
        </form>
    </body>
    </html>
    
  • 相关阅读:
    (转载)关于一些对location认识的误区
    Python内置数据结构--列表
    Maven
    Python基础语法
    安装ipython和jupyter
    Python环境安装
    Java多线程
    SpringMVC集成springfox-swagger2自动生成接口文档
    SpringMVC拦截器
    SpringMVC异常处理器
  • 原文地址:https://www.cnblogs.com/Price/p/3222878.html
Copyright © 2011-2022 走看看