getElementById.contentDocument error in IE

后端 未结 6 460
不思量自难忘°
不思量自难忘° 2020-11-30 10:57

   

        
6条回答
  •  一整个雨季
    2020-11-30 11:56

    The cross-browser equivalent to contentDocument (including Firefox itself, where contentDocument does work) is contentWindow.document.

    So try:

    alert(document.getElementById('iView').contentWindow.document);
    

    contentWindow gets you a reference to the iframe's window object, and of course .document is just the DOM Document object for the iframe.

    Here's an article that summarizes better.

提交回复
热议问题