js让一行页脚保持在底部

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

js让一行页脚保持在底部

  2020-05-12 我要评论
测了一下,还可以,在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需刷新才能执行]

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们