码迷,mamicode.com
首页 > 其他好文 > 详细

iframe自适应高度

时间:2018-10-21 21:53:02      阅读:164      评论:0      收藏:0      [点我收藏+]

标签:lin   ram   document   width   get   oom   amp   scroll   适应   

html:

<iframe name="ifraRight" id="ifraRight"  src="jsp/countRoomMeasure.jsp" onload="iFrameHeight(‘ifraRight‘)" height="100%" frameborder="0" width="100%" scrolling="auto"></iframe>

js:

//iframe自适应高度
function iFrameHeight(id) {

    var ifm= document.getElementById(id);

    var subWeb = document.frames ? document.frames[id].document : ifm.contentDocument;

    if(ifm != null && subWeb != null) {

       ifm.height = subWeb.body.scrollHeight;

    }

}

 

iframe自适应高度

标签:lin   ram   document   width   get   oom   amp   scroll   适应   

原文地址:https://www.cnblogs.com/wanyong-wy/p/9826692.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!