zoukankan      html  css  js  c++  java
  • 非IE用window.open弹出窗口并向父窗口传值

    弹出窗口

      function OpenDialog(url, name, nWidth, nHeight) {
            var iTop = (window.screen.availHeight - 30 - nHeight) / 2;       //获得窗口的垂直位置;
            var iLeft = (window.screen.availWidth - 10 - nWidth) / 2;           //获得窗口的水平位置;
            var name = "新窗口_" + Math.random();
    
            //IE9下面不能加name
            window.open(url, '', "height=" + nHeight + ", width=" + nWidth + ",top=" + iTop + ",left=" + iLeft + ", location=yes,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no"); //写成一行
    
        }

    向父窗口传值

    function SelAUserfulView(data)
    {
         var words=data;
    try {
          if(words=="")
          {
              alert("没有选中行!");
              return;
          }
          window.returnValue = words;
    window.opener.DLShowModalDialogReturnArgs =words;
    //回调函数
    window.opener.SelUserfulView_return(); 
    window.close();
        }
        catch (e) {
            window.close();
        }
    
    }

    设置参数

    var DLShowModalDialogReturnArgs = null;
    function SelUserfulView_return() {
        //PC端 返回值变量DLShowModalDialogReturnArgs
        if (DLShowModalDialogReturnArgs == null || DLShowModalDialogReturnArgs == undefined) {
            return;
        }
        if (DLShowModalDialogReturnArgs == "") {
            return;
        }
        var response = DLShowModalDialogReturnArgs;
    
        var v1= "";//批阅内容
        var v2= "";//是否强条
        var sArray = response.split(',');
    
        v1= sArray[1];
       v2= sArray[2];
    
    
        document.getElementById("父窗口的ID1").value = MarkTxt;
        //设置Select的Value值为4的项选中
        $("#父窗口的ID2").val(SynSTId);
    }
  • 相关阅读:
    Freefilesync-文件夹自动同步
    考研打卡_Day077
    考研打卡_Day076
    考研打卡_Day075
    考研打卡_Day074
    考研打卡_Day073
    考研打卡_Day072
    考研打卡_Day071
    考研打卡_Day070
    考研打卡_Day069
  • 原文地址:https://www.cnblogs.com/LessIsMoreZ/p/7443165.html
Copyright © 2011-2022 走看看