简体   繁体   English

相同代码的两个版本返回不同的结果

[英]Two version of the same code returns different result

The two code below look same but they give me different result in IE8. 下面的两个代码看起来相同,但是它们在IE8中给了我不同的结果。 Do you have any idea about that? 你有什么想法吗?

$('#frameMain').load(function(){                                
    var bodyHeight = $(this.contentDocument).find('body').attr('scrollHeight');                
    var bodyHeight2 = document.getElementById('frameMain').document.body.scrollHeight;
});

This code refer to parent body, not child. 此代码是指父机构,而不是子机构。

document.getElementById('frameMain').document.body.scrollHeight

It should be like this: 应该是这样的:

document.getElementById('frameMain').contentDocument.body.scrollHeight;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM