解决returnValue问题
通过以上的种种测试,我们已经知道chrome的showModalDialog方法很像执行了window.open方法,那么我们可以利用window.opener来实现window.returnValue的功能。
父窗体部分js代码:
[javascript]
var returnValue = window.showModalDialog("son.html ", window);
//for chrome
if (returnValue == undefined) {
returnValue = window.returnValue;
}
[javascript]
if (window.opener != undefined) {
//for chrome
window.opener.returnValue = "opener returnValue";
}
else {
window.returnValue = "window returnValue";
}
window.close();
这样也在IE,FireFox,Chrome,Safari等浏览器下都可以通用了。