Iframe高度自适应代码

Iframe高度自适应IE与FF环境下均可用 看下面的代码: scripttype="text/javascript" functionSetCwinHeight(){ varbobo=document.getElementById("bobo");//iframeid if(document.getElementById){ if(bobo!window.opera){ if(bobo.contentDocumentbobo.cont

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

  看下面的代码:

<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.sj33.cn/”></iframe>

查看运行效果:


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

给TA打赏
共{{data.count}}人
人已打赏
CSS教程

CSS如何定义一条水平虚线?

2008-4-3 7:31:00

CSS教程

13种常用按钮、文本框、表单等CSS样式

2008-8-6 18:17:00

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
有新私信 私信列表
搜索