首页 > 其他 > 详细

iframe自适应高度

时间:2018-10-21 21:33:11      阅读:150      评论:0      收藏:0      [点我收藏+]

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自适应高度

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!