从windows.showModalDialog迁移到window.open

时间:2018-09-11 11:53:00

标签: javascript jquery

我需要帮助...我有一个为IE10 / IE11编写的javascript代码,现在我必须在Google Chrome浏览器中实现一些功能,但是在代码中我具有windows.showModalDialog函数,据我所知,它在chrome上不起作用当前,我需要迁移此代码,以便它在.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;
        }

0 个答案:

没有答案