iFrame -- onload 加载时,调用‘自适应高度’代码。 使用定时器,等待iFrame.contentWindow中的对象加载完毕。 <iFrame id="bodyFrame" name="bodyFrame" src="body.do" mce_src="body.do" width="100%" height="500" marginwidth=″0″ marginheight=″0″ frameborder="0" scrolling="no" space="0" vspace="0" οnlοad="init()"></iframe> <mce:script type="text/javascript"><!-- var iIntervalID= null; function resize(){ var ifr = document.getElementById('bodyFrame'); var target = ifr.contentWindow; if(target == null) return; if(target.document.body.scrollHeight==null) return; var height = target.document.body.scrollHeight; ifr.style.height = height>500?height:500+"px"; window.clearInterval(iIntervalID); } function init(){ iIntervalID = window.setInterval(resize, 500); } // --></mce:script>