首頁 > web前端 > js教程 > js让一行页脚保持在底部_javascript技巧

js让一行页脚保持在底部_javascript技巧

WBOY
發布: 2016-05-16 19:05:17
原創
1055 人瀏覽過

测了一下,还可以,在IE6、IE7、FIREOFX等都没有问题! 窗口缩小时也没有问题!

复制代码 代码如下:

<script> <BR>function test(){ <BR> var infoHeight = document.getElementById("info").scrollHeight; <BR> var bottomHeight = document.getElementById("bottom").scrollHeight; <BR> var allHeight = document.documentElement.clientHeight; <br><br> var bottom = document.getElementById("bottom"); <BR> if((infoHeight + bottomHeight) < allHeight){ <BR> bottom.style.position = "absolute"; <BR> bottom.style.bottom = "0"; <BR> }else{ <BR> bottom.style.position = ""; <BR> bottom.style.bottom = ""; <BR> } <br><br> setTimeout(function(){test();},10); <BR>} <BR>test(); <BR></script>


[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板