标签:
iframe自适应高度,实现原理是在iframe页面加载完成后将页面的高度赋值到iframe上。
<iframe id="myIframe" src="/src.html" style="width:1220px; border:0px;" scrolling="no" onload="autoHeight()"></iframe>
function autoHeight() {
var ifr = document.getElementById(‘myIframe‘); ifr.height = (ifr.contentDocument && ifr.contentDocument.body.offsetHeight) || (ifr.contentWindow.document.body.scrollHeight);}
标签:
原文地址:http://www.cnblogs.com/jingsha/p/5829607.html