弹出页面之间传值

假如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" οnclick="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="关闭" οnclick="fun()" /></div>
    </form>
</body>
</html>

 

posted on 2013-07-29 14:29  seaconch 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/Price/p/3222878.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值