The return value of showModalDialog can be obtained in IE and Firefox, but Null is returned in Google Chrome. The solution is described below.
Parent page:
Copy codeThe Code is as follows:
Function openwindows (){
Var obj = new Object ();
// Open the modal subform and obtain the return value
Var retval = window. showModalDialog ("ordervideo. jsp? RderIds = "+" 0030, ", obj," dialogWidth = 500px; dialogHeight = 500px ");
// For chrome
If (retval = undefined ){
Retval = window. returnValue;
}
Alert (retval );
}
Subpage:
Copy codeThe Code is as follows:
Function onload (){
// For chrome
If (window. opener! = Undefined) {// The window. opener value is not empty in Google's browser. It is undefined in IE/Firefox, so that it can be determined whether it is Google's browser.
Window. opener. returnValue = flag; // window used to assign a value to the return value in Google's browser. opener. close (); // you must close it once. Otherwise, run the following window. close () cannot close the pop-up window, because the pop-up window in Google browser is a new window
}
Else {
Window. returnValue = flag; // This assignment method is compatible with IE/Firefox, but does not support Google browsers.
}
Window. close ();
}