window.opener返回值的用法

1.父窗体 代码
   <input  type="button" visible="false"  id="Button1" class="btn" value="点此添加照片" οnclick="javascript:ontc_small();" />

  js  代码如下:


    function ontc_small(){
    
    var url='pic.aspx?filepath=small&txtpath=image_small&imgpath=img_small';
   
    window.open(url,'newwindow','height=400,width=600,top=100,left=100,scrollbars')
    
    }

2. 子窗体代码如下



function winBack()
{
       if(window.opener) {
       var v=$("#imgCropped").attr("src");
             fWindowText1 = window.opener.document.getElementById('<%=txtpath %>');
              fWindowText1.value = v;
              fWindowText2 = window.opener.document.getElementById("<%=imgpath %>");
              fWindowText2.src=v;
             
             
              window.close();
       }
}

说明:  fWindowText1 = window.opener.document.getElementById('<%=txtpath %>');

 其中 <%=txtpath %>  是父窗体中的的控件id,这样子窗体的参数就可以赋值给父窗体的控件了

转载于:https://www.cnblogs.com/tiancai/archive/2012/03/23/2413204.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值