iframe自适应宽度和高度

1 autoHeight();
2 function autoHeight(){
3     var tag=document.getElementById('iframe');
4     if(tag && tag.clientHeight < tag.contentWindow.document.body.scrollHeight){
5         tag.style.height = tag.contentWindow.document.body.scrollHeight + 'px';
6     }
7     setTimeout("autoHeight()", 10);
8 }
原文地址:https://www.cnblogs.com/yeahooh/p/2972478.html