网络编程 
首页 > 网络编程 > 浏览文章

js让一行页脚保持在底部

(编辑:jimmy 日期: 2025/12/29 浏览:3 次 )
测了一下,还可以,在IE6、IE7、FIREOFX等都没有问题! 窗口缩小时也没有问题!

复制代码 代码如下:
<script language="JavaScript" type="text/javascript">
function test(){
 var infoHeight = document.getElementById("info").scrollHeight;
 var bottomHeight = document.getElementById("bottom").scrollHeight;
 var allHeight = document.documentElement.clientHeight;

 var bottom = document.getElementById("bottom");
 if((infoHeight + bottomHeight) < allHeight){
  bottom.style.position = "absolute";
  bottom.style.bottom = "0";
 }else{
  bottom.style.position = "";
  bottom.style.bottom = "";
 } 

 setTimeout(function(){test();},10);
}
test();
</script>


[Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]
上一篇:多浏览器兼容的右下角广告代码(已测)
下一篇:CSS也可以把IE6弄死
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网 网站地图 SiteMap