网站首页 网站建设 IT知识 IT知识教程 js让一行页脚保持在底部

js让一行页脚保持在底部

2021-05-26 21:20:40
测了一下,还可以,在IE6、IE7、FIREOFX等都没有问题!窗口缩小时也没有问题!

复制代码 代码如下:
<scriptlanguage="JavaScript"type="text/javascript">
functiontest(){
varinfoHeight=document.getElementById("info").scrollHeight;
varbottomHeight=document.getElementById("bottom").scrollHeight;
varallHeight=document.documentElement.clientHeight;

varbottom=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%;} 22222222222222222222222222220000 bottom [Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。 如涉及版权问题,请提交至online#300.cn邮箱联系删除。

以上产品还未完全满足我的所有需求,在下方提交我的专属需求
我的专属需求:
*手机号:
*验证码:
img
咨询报价
现在咨询
img

在线咨询

建站在线咨询

img

微信咨询

扫一扫添加
动力姐姐微信

img
img

TOP