首页 > 其他 > 详细

iframe自适应高度问题

时间:2014-10-24 20:21:53      阅读:306      评论:0      收藏:0      [点我收藏+]
<iframe src="index.html" id="iframe" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" onLoad="iFrameHeight()"></iframe>
<script type="text/javascript" language="javascript">   
  function iFrameHeight() {   
    var ifm= document.getElementById("iframe");   
    var subWeb = document.frames ? document.frames["iframe"].document : ifm.contentDocument;//(document.frames检测是否是ie,ie下document.frames["iframe"].document,其他为ifm.contentDocument)   
    if(ifm != null && subWeb != null) {
       ifm.height = subWeb.body.scrollHeight;
       ifm.width = subWeb.body.scrollWidth;
    }   
  }   
</script>

iframe自适应高度问题

原文:http://www.cnblogs.com/lvke/p/4048984.html

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