Because the system must be compatible with the shutdown method used by the original IE, after debugging and testing, window.dialogArguments needs to be tested again, otherwise problems may occur.
function OKEnd(vals) { if (vals == null) vals = "TRUE"; if (typeof (window.opener) == "undefined") { if (typeof (window.dialogArguments) != "undefined") { if (window.dialogArguments && window.dialogArguments != null) { window.opener = window.dialogArguments; if (window.opener && window.opener != null) { window.opener.ReturnValue = vals; } } } } else { if (window.opener && window.opener != null) { window.opener.ReturnValue = vals; } } window.returnValue = vals; self.close();}For the return value received, you just need to check the opener in the original IE reception mode, as follows:
//Select change department function SetOrganizeTree2() { var url="popup page"; var ret = window.showModalDialog(url, window, "dialogWidth=400px;dialogHeight=500px;status=no;help=no;scroll=yes;resizable=yes;"); if (typeof (ret) == "undefined") { ret = window.ReturnValue; } if (ret) { document.getElementById("hidDeptCode2").value = ret; document.getElementById("btnDeptCodeAdd").click(); } return false; }Perfect solution to the compatibility problem of JS modal window return value
1. When opening the pop-up window, pass window as the second parameter.
var result = window.showModalDialog(url, window, "dialogWidth=" + width + "px;dialogHeight=" + height + "px;resizable:yes;") if (typeof (result) == 'undefined') { result = window.ReturnValue; } return result;2. In the pop-up window, execute the following JS to receive the incoming window
if (typeof (window.opener) == 'undefined') window.opener = window.dialogArguments;
3. Before the pop-up window is closed, call the following JS assignment to return the value
window.retureValue = vals; if (window.opener && window.opener != null) window.opener.ReturnValue = vals; window.close();
Principle discussion:
Under Chrome, the standard method can return the value when the pop-up page does not post it back. If there is a postback, the return value cannot be returned normally. This method can be solved.
Standard methods under IE, sometimes the value cannot be returned correctly for unknown reasons, and this method can be solved.
FF has not been tested in detail, so there should be no big problem.
The perfect solution to the above JS modal window return value compatibility problem is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.