兼容火狐和IE的showModalDialog
//模态窗口兼容IE 和火狐
function CalcShowModalDialogLocation(dialogWidth, dialogHeight) {var iWidth = dialogWidth;
var iHeight = dialogHeight;
var iTop = (window.screen.availHeight - 20 - iHeight) / 2;
var iLeft = (window.screen.availWidth - 10 - iWidth) / 2;
return 'dialogWidth:' + iWidth + 'px;dialogHeight:' + iHeight + 'px;dialogTop: ' + iTop + 'px; dialogLeft: ' + iLeft + 'px;center:yes;scroll:no;status:no;resizable:0;location:no';
}
var DialogLocation = CalcShowModalDialogLocation(520, 400);
var result = window.showModalDialog('${base}/list/addOupdatePointRouleList.htm?ruleCode=0&isNew=1',
window, DialogLocation);
document.location.reload();
本文介绍了一个用于创建兼容Internet Explorer和Firefox浏览器的模态对话框的方法。通过自定义JavaScript函数CalcShowModalDialogLocation,可以计算并设置模态窗口的位置和尺寸,确保在不同浏览器中的一致体验。

2万+

被折叠的 条评论
为什么被折叠?



