js让一行页脚保持在底部
2008-04-11 00:00
375 查看
测了一下,还可以,在IE6、IE7、FIREOFX等都没有问题! 窗口缩小时也没有问题!
www.jb51.net 脚本之家
*{ margin:0; padding:0}
#info{background:#33CCFF}
#bottom{background:#FFCC00;width:100%;}
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
20000
bottom
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();
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
<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>
www.jb51.net 脚本之家
*{ margin:0; padding:0}
#info{background:#33CCFF}
#bottom{background:#FFCC00;width:100%;}
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
20000
bottom
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();
[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
相关文章推荐
- js让一行页脚保持在底部
- 页脚最小高度100%保持在页面底部的布局方法
- 最小高度100%页脚保持在底部的布局方法
- 页脚保持在底部
- JS实现让页脚一直固定在页面底部
- js让滚动条保持在底部
- CSS实例:让页脚保持在未满屏页面的底部
- 最小高度100%页脚保持在底部的布局方法
- 怎样保持页脚始终在页面底部无论页面几屏或是页面不足一屏
- 将页脚保持在页面的底部——Javascript+Css实现
- 保持页脚始终在最底部
- js将滚动条scrollbar保持在最底部
- 网站页脚始终保持底部
- CSS + DIV 让页脚始终保持在页面底部
- 如何保持页脚始终在页面底部
- CSS布局:让页脚始终保持底部的方法
- 页脚永远至于页面底部的js
- Javascript让页脚保持在未满屏页面的底部
- JS实现让页脚一直固定在页面底部
- 最小高度100%页脚保持在底部的布局方法