Iframe自适应高度
<iframe src="home.jsp" frameborder=0 width="970" scrolling="no" name="mainFrame" align="center" onLoad="iFrameHeight();"> </iframe>
//IFrame自动适应屏幕
function iFrameHeight() {
var ifm= document.getElementById("mainFrame");
var subWeb = document.frames ? document.frames["mainFrame"].document :
ifm.contentDocument;
if(ifm != null && subWeb != null) {
ifm.height = subWeb.body.scrollHeight;
}
}
本文详细介绍了如何使用JavaScript实现Iframe元素自适应屏幕高度的功能,包括关键函数iFrameHeight()的使用方法。
5232

被折叠的 条评论
为什么被折叠?



