弹出窗体值回调

方法一:

父窗体:

<input type="text" runat="server" id="returnValue" style=" display:none;"  name="returnValue" />

 方法一:

//设置模式窗口的一些状态值
  var windowStatus = "dialogWidth:650px;dialogHeight:600px;center:1;status:0;";
  //在模式窗口中打开的页面
  var url = "impfile.aspx?path="+encodeURI(path);

  var obj = document.form1; //指定页面对象 form1当前页面<form name="form1">
  var returnValue = window.showModalDialog(url, obj, 'dialogHeight:550px;dialogWidth:600px;center:yes');  //方法返回值 

方法二:

//设置模式窗口的一些状态值
            var windowStatus = "dialogWidth:650px;dialogHeight:600px;center:1;status:0;";
            //在模式窗口中打开的页面
            var url = "impfile.aspx?path="+encodeURI(path);

            var obj = document.form1; //指定页面对象
            var returnValue = window.showModalDialog(url, window, 'dialogHeight:550px;dialogWidth:600px;center:yes');  //方法返回值 
function fnUpdate(ret) {
            document.getElementById("returnValue").value = ret;
        }

子窗体:

 方法一:

  var obj = window.dialogArguments; //父页面对象
                
  obj.elements["returnValue"].value = json; //给父页面对象赋值
  window.close();

 方法二:

//调用主窗口里的函数:
window.dialogArguments.函数名();
//你可以在子窗体关闭的时候刷新父窗体,可以这么写:
window.dialogArguments.location.href=window.dialogArguments.location.href;
window.focus();
window.close();
原文地址:https://www.cnblogs.com/fjptwwf/p/6047297.html