声明:有更好的方法在下一篇内容中
100%
http://www.360doc.com/content/11/1102/15/55892_161105115.shtml
iframe自适应高度 转自:
http://www.cnblogs.com/Nbge/archive/2013/06/14/3135697.html
< iframe src="index.html" id="iframepage" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" onLoad="iFrameHeight()"></ iframe > |
<script type= "text/javascript" language= "javascript" > function iFrameHeight() { var ifm= document.getElementById( "iframepage" ); var subWeb = document.frames ? document.frames[ "iframepage" ].document : ifm.contentDocument; if (ifm != null && subWeb != null ) { ifm.height = subWeb.body.scrollHeight; ifm.width = subWeb.body.scrollWidth; } } </script> |