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,这样子窗体的参数就可以赋值给父窗体的控件了

  • 相关阅读:
    Python电影投票系统
    Python打印一个等边三角形
    打印正直角三角形
    MySQL指令
    MySQL安装 8.0.15版本
    局部变量 全局变量
    目录
    格式化输出
    转义字符
    ffmpeg 从内存中读取数据(或将数据输出到内存)
  • 原文地址:https://www.cnblogs.com/tiancai/p/2413204.html
Copyright © 2011-2022 走看看