根据内容自动调整IFrame高度
点击次数:25 次 发布日期:2008-11-26 23:09:59 作者:源代码网
|
<SCRIPT LANGUAGE="JavaScript"> function f_frameStyleResize(targObj){ var targWin = targObj.parent.document.all[targObj.name]; if(targWin != null) { var HeightValue = targObj.document.body.scrollHeight if(HeightValue < 600){HeightValue = 600} //不小于600 targWin.style.pixelHeight = HeightValue; } } function f_iframeResize(){ bLoadComplete = true; f_frameStyleResize(self); } var bLoadComplete = false; window.onload = f_iframeResize; </SCRIPT> 注意:iframe必须要有name属性,否则无效。 源代码网供稿. |
