zoukankan      html  css  js  c++  java
  • window.opener返回值的用法

    1.父窗体 代码
       <input  type="button" visible="false"  id="Button1" class="btn" value="点此添加照片" onclick="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,这样子窗体的参数就可以赋值给父窗体的控件了

  • 相关阅读:
    冒泡算法
    Eclipse 安装插件(aptana、svn 、git、Java EE、JSHint)
    smtp和pop3
    EJB 3.0 + JBOSS 5.1
    有状态EJBBean和无状态的EJBBean
    EJB3.0在发布时出现异常javax.naming.NameNotFoundException: myqueue not bound
    Django之路由系统
    Mysql安装与连接
    Django之Form组件
    jinja2模板
  • 原文地址:https://www.cnblogs.com/tiancai/p/2413204.html
Copyright © 2011-2022 走看看