iframe 自适应高度

<script type="text/javascript" language="javascript">
function iFrameHeight() {
 var ifm= document.getElementById("jp_logs");
 var subWeb = document.frames ? document.frames["jp_logs"].document : ifm.contentDocument;
 if(ifm != null && subWeb != null) {
  ifm.height = subWeb.body.scrollHeight;
 }
}
</script>

 

<iframe id="jp_logs" src=\'#\'" frameborder="0" scrolling="No" width="900" onLoad="iFrameHeight()"></iframe>

你可能感兴趣的:(iframe,自适应高度)