我需要访问IFRAME内文档的文档对象.有没有办法在IE7和IE8上做到这一点?

I need to access document object of document inside an IFRAME. Is there a way to do that for IE7 and IE8?

本文关键字:文档 IE8 IE7 这一点 访问 IFRAME 有没有 对象      更新时间:2023-09-26

我需要在<iframe>中获取文档的scrollHeight属性。我尝试了所有的选项:

contentWindow.document  
contentDocument  
window.frames  

所有这些工作良好的IE9,chrome和FF。但我无法让它在IE7和IE8中工作。

如果有人有解决方案,那就太好了。

谢谢

try out:

contentWindow.documentElement.document

试试这个

<script>
    var iframe_doc = "window.document.getElementById('your_iframe_id').document";
    iframe_doc = eval(iframe_doc);
</script>

上面的代码应该返回iframe文档,然后获得iframe文档的scrollHeight属性。