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>
    
  • 相关阅读:
    http协议
    web自动化测试
    测试用例的编写
    软件测试基础知识
    内置对象session
    eclipse中快捷键使用技巧
    多线程
    jsp中的九大内置对象
    制作网站用到的一点知识
    正则表达式 7 ----大括号
  • 原文地址:https://www.cnblogs.com/Price/p/3222878.html
Copyright © 2011-2022 走看看