//HTML结构
<div id=demodiv style="width: 100%;">
<iframe id="searchiframe" width=100% src="index.jsp"/>"
</div>
//在iframe引入的index.jsp页面编写,外层DIV和iframe不需要指定高度
$(function(){
var pa_frame=parent.document.getElementById('searchiframe');
var height = pa_frame.contentWindow.document.body.scrollHeight+'px';
pa_frame.style.height=height;
});
div下的iframe随着内容的多少而控制div的高度
最新推荐文章于 2023-04-12 10:09:10 发布