javascript - 从 windows.showModalDialog 迁移到 window.open
问题描述
我需要帮助...我有一个为 IE10 / IE11 编写的 javascript 代码现在我必须在 Google Chrome 中实现一些功能,但在代码中我有功能 windows.showModalDialog 我知道目前在 chrome 上不起作用,我需要迁移此代码以使其在 window .open 上运行,有人可以帮忙吗?
function ShowContactSearch() {
var windowWidth = 800, windowHeight = 600, centerWidth = (screen.availWidth - windowWidth) / 2, centerHeight = (screen.availHeight - windowHeight) / 2 - 20;
var result = window.open('/Contact.aspx', null, 'dialogWidth:1300px; dialogHeight:720px; center:1; resizable:1; status=1');
if (result != null) {
ContactChosen(result, '1');
}
function ContactChosen(contactId, cType) {
var ct = document.getElementById("<%=hfChosenContactId.ClientID %>");
if (contactId == null || contactId == "" || ct.value == "" || contactId.toLowerCase().indexOf(ct.value.toLowerCase()) < 0) {
ct.value = contactId;
document.getElementById("<%=hfCType.ClientID %>").value = cType;
document.getElementById("<%=bChosenContactId.ClientID %>").click();
}
return false;
}