簡體   English   中英

將 IE8 適配到 IE11

[英]Adapting IE8 to IE11

我有這個代碼:

container = document.getElementById("menuContainer");

后來:

    container.document.open("text/html");
    container.document.writeln(content);
    container.document.close();

在 IE8 中有效,但在 IE11 中警告我:

在此處輸入圖片說明

我能做什么?

DOM Level 2開始,推薦的從節點到文檔的標准引用是node.ownerDocument 根據MDN:自 IE6 起支持ownerDocument 在 IE 中node.document也被支持到 IE10。

因此,您的代碼的修復將是:

container.ownerDocument.open(...);

在示例中使用document.write僅用於演示輸出,而不是作為真正的代碼,因此我沒有在此答案中處理它的使用。

暫無
暫無

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

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