The return value of showModalDialog can be obtained under IE and Firefox, but it will return Null under Google Chrome. The solution is introduced below.
Parent page:
Copy the code code as follows:
function openwindows(){
var obj = new Object();
//Open the modal subform and get the return value
var retval = window.showModalDialog("ordervideo.jsp?rderIds="+"0010,0020,0030",obj,"dialogWidth=500px;dialogHeight=500px");
//for chrome
if(retval == undefined) {
retval = window.returnValue;
}
alert(retval);
}
Subpage:
Copy the code code as follows:
function onload(){
//for chrome
if(window.opener != undefined) { //The value of window.opener is not empty under Google Chrome, but is undefined under IE/Firefox, so you can judge whether it is Google Chrome.
window.opener.returnValue = flag; //The method of assigning a return value under Google Chrome window.opener.close(); //This must be closed once, otherwise the pop-up window cannot be closed by executing the following window.close(), because The pop-up window under Google Chrome is a new window
}
else {
window.returnValue=flag; //This assignment method is compatible with IE/Firefox, but does not support Google Chrome
}
window.close();
}