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>
    
  • 相关阅读:
    存储过程3前台
    最简单Login程序
    存储过程前台2
    程序员 开发工具箱
    存储过程4前台
    存储过程 insert
    公司网络解决方案
    存储过程前台
    linux常用指令
    ReentrantLock源码解析3优先响应中断的lockInterruptibly
  • 原文地址:https://www.cnblogs.com/Price/p/3222878.html
Copyright © 2011-2022 走看看