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:
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:
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. This determines 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 following window will be executed .close() cannot close the pop-up window, 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 not Google Chrome
}
window.close();
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn