JS模态窗口返回值兼容问题解决方案
1、打开弹出窗口时把 window 作为第二个参数传入。
var result = window.showModalDialog(url, window, "dialogWidth=" + width + "px;dialogHeight=" + height + "px;resizable:yes;")
if (typeof (result) == 'undefined') {
result = window.ReturnValue;
}
return result;
2、在弹出窗口中,执行如下JS,以接收传入的window
if (typeof (window.opener) == 'undefined') window.opener = window.dialogArguments;
3、弹出窗口关闭前,调用如下JS赋返回值
window.retureValue = vals;
if (window.opener && window.opener != null)
window.opener.ReturnValue = vals;
window.close();