Chinaunix首页 | 论坛 | 博客
  • 博客访问: 756094
  • 博文数量: 160
  • 博客积分: 2516
  • 博客等级: 大尉
  • 技术积分: 1511
  • 用 户 组: 普通用户
  • 注册时间: 2004-10-24 17:58
文章分类

全部博文(160)

文章存档

2019年(2)

2018年(3)

2017年(15)

2016年(3)

2015年(11)

2014年(3)

2013年(1)

2012年(3)

2011年(17)

2010年(25)

2009年(17)

2008年(13)

2007年(14)

2006年(21)

2005年(10)

2004年(2)

分类: 系统运维

2006-11-23 21:27:51

 

 

iframe 自动适应高度:

 

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
//extra height in px to add to iframe in FireFox 1.0+ browsers
var FFextraHeight=getFFVersion>=0.1? 16 : 0 

function dyniframesize(iframename) {
  var pTar = null;
  if (document.getElementById){
    pTar = document.getElementById(iframename);
  }
  else{
    eval('pTar = ' + iframename + ';');
  }
  if (pTar && !window.opera){
    //begin resizing iframe
    pTar.style.display="block"
    
    if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
      //ns6 syntax
      pTar.height = pTar.contentDocument.body.offsetHeight+FFextraHeight; 
    }
    else if (pTar.Document && pTar.Document.body.scrollHeight){
      //ie5+ syntax
      pTar.height = pTar.Document.body.scrollHeight;
    }
  }
}
 
onload="javascript:{dyniframesize('myTestFrameID');}" 
marginwidth=0 marginheight=0 frameborder=0 
scrolling=no src="/myiframesrc.php" 
width=200 height=100>
阅读(3063) | 评论(5) | 转发(0) |
0

上一篇:Log4j 配置参数

下一篇:Linux socket c++

给主人留下些什么吧!~~