<iframe id="text__a" width="100%" align="left" scrolling="no" style="border:1px solid #4892C1;position:relative;" src="a.html" frameborder="1"></iframe>
jquery代码1:
//注意:下面的代码是放在iframe引用的子页面中调用
$(window.parent.document).find("#text__a").load(function(){
var main=$(window.parent.document).find("#iframe");
var this.height=$(document).height()+30;
main.height(this.height);
})
jquery代码2:
//注意:下面的大面是与iframe代码放在同一页面调用
$("#text__a").load(function(){
var mainheight = $(this).contents().find("body").height()+30;
$(this).height(mainheight);
});