簡體   English   中英

Edge中完全不推薦使用window.showModalDialog

[英]window.showModalDialog totally deprecated in Edge

我有一個與Edge兼容的網站(以前僅與IE兼容...)。

問題是,我不知道如何處理舊的showModalDialog元素。 我希望可以有一個簡單的解決方法,但我認為這是沒有希望的。 我需要一個返回值...

這是我當前的代碼:

function openCalendar(oDate){
    if (typeof jQuery != 'undefined' && oDate instanceof jQuery) {
        var dateValue   = oDate.val();
        var color       = oDate.css('color');
    }else{
        var dateValue   = oDate.value;
        var color       = oDate.style.color;
    }

  var month     = "";
  var year      = "";

    if (dateValue != "" && color != "red") {
        month = dateValue.substring(3,5);
        year  = dateValue.substring(6,10);
    }
  search    = window.showModalDailog('../calendar/calendar.jsp?month='+month+'&year='+year ,null,'dialogWidth=220px;dialogHeight=220px;STATUS:NO;SCROLL:NO;help:no');

  if (search != null && search != "undefined" && search != "") {
        if (typeof jQuery != 'undefined' && oDate instanceof jQuery) {
            oDate.val(search);
            oDate.css('color', "");
        }
        else {
            oDate.value           = search;
            oDate.style.color   = "";
            oDate.className   = "InputText";
        }
  }
}

在這種情況下我該怎么辦?

謝謝您的幫助。

PS:我必須使用jQuery 1.3.2

或者,您可以嘗試使用Window.Open()。 您可以檢查它是否解決了您的問題。

代碼示例:

 function ShowInformationMessage(message) { var ie = document.all; varl url = '../TestWeb/Error/ErrorMessages/PopInfoUI.aspx?val=' + message if(ie) window.showModalDialog(url, 'window', 'status:no; help:no; dialogWidth:400px; dialogHeight:120px'); else { var theWin = window.open(url, 'theWin', 'width=400, height=120, status=no'); theWin.focus(); } } 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM