随笔 - 59  文章 - 70  trackbacks - 0
<2009年5月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

  •  

积分与排名

  • 积分 - 172050
  • 排名 - 338

最新评论

阅读排行榜

评论排行榜

之前写的iframe的自适应高度语句都是这样写的:
onload="this.height=ifr.document.body.scrollHeight"

结果发现不能兼容firfox,于是改成下面的代码:
<script>
function SetCwinHeight()

var ifr
=document.getElementById("ifr"); //iframe id 
if (document.getElementById)
if (ifr&& !window.opera)
if (ifr.contentDocument && ifr.contentDocument.ifr.offsetHeight)
ifr.height 
= ifr.contentDocument.body.offsetHeight; 
}
else if(ifr.Document && ifr.Document.body.scrollHeight)
ifr.height 
= ifr.Document.body.scrollHeight; 
}
 
}
 
}
 
}

</script>
<iframe id="ifr" src="/login.jsp" frameborder="0" width="715" scrolling="No" onload="Javascript:SetCwinHeight()"></iframe>
成功!
posted on 2009-05-11 18:53 JasonChou 阅读(546) 评论(4)  编辑  收藏 所属分类: html

FeedBack:
# re: iframe自适应高度问题 2009-05-18 11:52 宋雪
您好!我是《中国科技博览》编辑部的宋雪,国家级刊物现对外征稿。欢迎您咨询投稿工作Q 237692305电话010-83753033转分机304 13671307412 统一投稿信箱zgkjbls@163.com 宋雪期待与您合作!  回复  更多评论
  
# re: iframe自适应高度问题 2009-07-10 14:32 ff
ccccccccccccccccc  回复  更多评论
  
# re: iframe自适应高度问题 2009-07-10 14:32 ff
www.admin173.com  回复  更多评论
  
# re: iframe自适应高度问题 2010-11-01 15:45 lele
我试了一下,在FF下还是不能自适应~  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: