js让一行页脚保持在底部分享


测了一下,还可以,在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需刷新才能执行]

----想了解更多的linux相关异常处理怎么解决关注<计算机技术网(www.ctvol.com)!!>



本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/jspttutorial/70889.html

(0)
上一篇 2020年4月21日
下一篇 2020年4月21日

精彩推荐