Chrome不支持showModalDialog模态对话框和无法返回returnValue的问题

时间:2021-08-10 17:07:31

父窗体部分js代码:

 var returnValue = window.showModalDialog("son.html ", window);
//for chrome
if (returnValue == undefined) {
returnValue = window.returnValue;
}

子窗体部分js代码:

if (window.opener != undefined) {
//for chrome
window.opener.returnValue = "opener returnValue";
}
else {
window.returnValue = "window returnValue";
}
window.close();

这样也在IE,FireFox,Chrome,Safari等浏览器下都可以通用了。