非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);
}

 

posted @ 2017-08-28 11:55  张追逐  阅读(563)  评论(0编辑  收藏  举报