chrome新版本中的showmodalDialog问题
本文关键字:showmodalDialog 问题 新版本 chrome | 更新日期: 2023-09-27 18:21:45
谷歌chrome在新版本中删除了showmodalDialog。我用这个浏览器的代码不起作用,我该如何解决我的问题?
function AddTime(OfferTime) {
var x = new Array();
var ClsPartColeg = document.getElementById("ClassParam").value;
x[0] = SrcName(ClsPartColeg, 'PartCombo');
if (OfferTime)
x[1] = OfferTime;
else
x[1] = '$$0$' + SrcName(ClsPartColeg, 'College') + '$';
var s = showModalDialog("../HtmlPage/ClsTime.htm", x, "status:0;help:0;dialogWidth:420px;dialogHeight:100px");
if (s)
Perform('NewTime;Item=' + s);
}
您有两个选项:
1-使用jQuery软模式插件,该插件使用iframe来显示您的模式URL,并添加阻止层以防止用户与父页面交互
2-使用window.open
打开您的模态,并使用onblur
和onload
将焦点放在模态页面上,直到用户关闭
<body onblur="self.focus()" onload="self.focus()">
第二种方法使用起来很烦人,我不建议使用