前台技术--window.showModalDialog带来的浏览器兼容问题
2014-03-27 11:47
369 查看
双击域的实现:http://blog.csdn.net/gaopeng0071/article/details/21179619,
继此篇博文,讲述的双击域实现,在后续发现使用window.showModalDialog模态框存在浏览器兼容性问题。
使用chrome时,会出现模态框的返回值无法返回到父页面,使用此种方式: window.returnValue
摘自:http://blog.csdn.net/luckzhang_la/article/details/17262421
这个方法存在浏览器兼容问题。采用ie内核的浏览器支持该方式,但采用谷歌内核的浏览器(如:Chrome)不支持。
不支持表现在window.showModalDialog()方法,采用谷歌内核的浏览器并不是打开一个模式弹出框而是window.open()。这样在弹出框里设置返回值window.returnValue="返回值";在父窗体获取时var vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])发现vReturnValue为undefined。
解决方案如下:
父页面:
详见其中第4行判断与第7行判断代码。
function ondbGuanLianADId(){
adId = window.showModalDialog('getAdForMac.action', null ,'dialogHeight=500px; dialogWidth=420px;');
var strs = adId;
if(strs==undefined){
strs=window.returnValue;
}
if(strs != undefined){
document.getElementById("guanLianADId").value = strs.split(":")[0];
document.getElementById("guanLianADName").value = strs.split(":")[1];
}
}子页面:
function test(){
// 解决IE与chrome浏览器版本差异问题
if (window.opener != undefined) {
//for chrome
window.opener.returnValue = document.getElementById("name1").value;
}
else {
window.returnValue = document.getElementById("name1").value;
}
window.close();
}
参考资源:http://blog.csdn.net/luckzhang_la/article/details/17262421
继此篇博文,讲述的双击域实现,在后续发现使用window.showModalDialog模态框存在浏览器兼容性问题。
使用chrome时,会出现模态框的返回值无法返回到父页面,使用此种方式: window.returnValue
摘自:http://blog.csdn.net/luckzhang_la/article/details/17262421
这个方法存在浏览器兼容问题。采用ie内核的浏览器支持该方式,但采用谷歌内核的浏览器(如:Chrome)不支持。
不支持表现在window.showModalDialog()方法,采用谷歌内核的浏览器并不是打开一个模式弹出框而是window.open()。这样在弹出框里设置返回值window.returnValue="返回值";在父窗体获取时var vReturnValue = window.showModalDialog(sURL [, vArguments] [, sFeatures])发现vReturnValue为undefined。
解决方案如下:
父页面:
详见其中第4行判断与第7行判断代码。
function ondbGuanLianADId(){
adId = window.showModalDialog('getAdForMac.action', null ,'dialogHeight=500px; dialogWidth=420px;');
var strs = adId;
if(strs==undefined){
strs=window.returnValue;
}
if(strs != undefined){
document.getElementById("guanLianADId").value = strs.split(":")[0];
document.getElementById("guanLianADName").value = strs.split(":")[1];
}
}子页面:
function test(){
// 解决IE与chrome浏览器版本差异问题
if (window.opener != undefined) {
//for chrome
window.opener.returnValue = document.getElementById("name1").value;
}
else {
window.returnValue = document.getElementById("name1").value;
}
window.close();
}
参考资源:http://blog.csdn.net/luckzhang_la/article/details/17262421
相关文章推荐
- window showModalDialog 在IE6 IE7 高度(height) 问题
- [技术]Window.ShowModalDialog使用手册
- window.showmodaldialog()模态窗口的最小化、最大化问题
- 网页关闭(解决window.close在火狐下不兼容问题) 区分浏览器类别
- window.showModalDialog相关问题小结
- 关于event 和 window.event问题及浏览器兼容问题
- window.showModalDialog弹出对话框刷新问题的总结
- window.showModalDialog弹出对话框刷新问题
- ucUncaught TypeError: window.showModalDialog is not a function关于showModalDialog停用的问题
- window.showModalDialog()弹出页面的关闭问题
- window showModalDialog 在IE6 IE7 高度(height) 问题
- js window.event 兼容浏览器问题
- 兼容ie,firefox window.showModalDialog
- window.showModalDialog两次加载问题,清除缓存
- 各个版本浏览器下使用window.close()兼容问题
- window.showModalDialog方式/模式窗口数据不刷新(缓存)问题
- [技术]Window.ShowModalDialog使用手册
- window.showModalDialog 内跳转页面的问题
- Window.ShowModalDialog的参数问题
- CSS Hack技术解决多浏览器兼容问题