Menu:

CSS布局实例

Iframe高度自适应 IE与FF环境下均可用

  
  Iframe高度自适应 IE与FF环境下均可用

  看下面的代码:

div css xhtml xml Example Source Code Example Source Code [www.oeedu.com]
<script type="text/javascript">
 function SetCwinHeight(){
  var bobo=document.getElementById("bobo"); //iframe id
  if (document.getElementById){
   if (bobo && !window.opera){
    if (bobo.contentDocument && bobo.contentDocument.body.offsetHeight){
     bobo.height = bobo.contentDocument.body.offsetHeight;
    }else if(bobo.Document && bobo.Document.body.scrollHeight){
     bobo.height = bobo.Document.body.scrollHeight;
    }
   }
  }
 }
</script>
<iframe width="100%" id="bobo" onload="Javascript:SetCwinHeight()" height="1" frameborder="0" src="http://www.oeedu.com/"></iframe>

查看运行效果:

div css xhtml xml Source Code to Run Source Code to Run [www.oeedu.com]

    [ 可先修改部分代码 再运行查看效果 ]

  
Article Provenance:Internet
Article Tags: Iframe 高度自适应 ie FF
评论: 0 | 查看次数: 1283