日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > javascript >内容正文

javascript

[JavaScript]让footer总是停留在页面的底部(footer all the way at the bottom of the page)

發(fā)布時間:2023/12/1 javascript 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 [JavaScript]让footer总是停留在页面的底部(footer all the way at the bottom of the page) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.


????? 在網(wǎng)頁的底部總是保留著公司的版本信息,如何是這部分信息來實現(xiàn)呢?下面的一段javascript演示了如何讓footer總是停留在頁面的底部。這段代碼我在實際使用的時候不是特別的完美,在包含有其他javascript控制的頁面和控件的時候會出現(xiàn)重疊的現(xiàn)象,這是因為沒有對頁面的Body進行onresize和onload操作,希望大家看后有解決的方法)

<HTML>
????
<HEAD>
????????
<title>讓footer總是停留在頁面的底部</title>

????????
<script?language="javascript">
<!--
function?moveFooter()?{
????
var?iBottom?=?0;
????
????
if?(document.all)?{
????????
if?(parseInt(document.body.scrollHeight)?>?parseInt(document.body.clientHeight))?{
????????????iBottom?
=?parseInt(document.body.scrollHeight);
????????}????
????????
else?iBottom?=?parseInt(document.body.clientHeight);
????????document.all[
"lyfooter"].style.pixelTop?=?iBottom?-?parseInt(document.all["lyfooter"].style.height);
????????document.all[
"lyfooter"].style.visibility?=?"visible";
????}
????
else?if?(document.layers)????{
????????
if?(document.height?>?self.innerHeight)?{
????????????iBottom?
=?document.height;
????????}????
????????
else?iBottom?=?self.innerHeight;????????????????
????????document.layers[
"lyfooter"].top?=?parseInt(iBottom?-?document.layers["lyfooter"].document.height);
????????document.layers[
"lyfooter"].visibility?=?"visible";????????????????
????}
????
else?if?(document.getElementById)?{?//NS6
????????if?(document.height?>?self.innerHeight)?{
????????????iBottom?
=?document.height;
????????}????
????????
else?iBottom?=?self.innerHeight;????????????????????
????????document.getElementById(
"lyfooter").style.top?=?(parseInt(iBottom?-?parseInt(document.getElementById("lyfooter").style.height)))?+?"px";????????
????????document.getElementById(
"lyfooter").style.visibility?=?"visible";????????
????????
????}
????
}
//-->
????????</script>
????
</HEAD>
????
????
<body?MS_POSITIONING="GridLayout"?onresize="moveFooter()"?onload="moveFooter()">
????????
<form?id="Form1"?method="post">
????
<!----bottom?part--------->
<div?id="lyfooter"?style="position:absolute;left:0px;top:100px;height:19px;z-index:2;visibility:hidden;">
????
<table?border="0"?width="100%"?cellspacing="0"?cellpadding="3">
??????
<tr>
????????
<td?width="100%"?bgColor="#319a63"?class="footnote"><font?color="#ffffff"?size="2px"?face="Verdana,?Arial,?Helvetica,?sans-serif">&copy;?
????????????????????????????????????2005?ABCDE,?Inc.
</font></td>
??????
</tr>
????
</table>
</div>
<!----/bottom?part--------->
????????
</form>
????
</body>
</HTML>

轉(zhuǎn)載于:https://www.cnblogs.com/rippleyong/archive/2005/11/24/283739.html

總結(jié)

以上是生活随笔為你收集整理的[JavaScript]让footer总是停留在页面的底部(footer all the way at the bottom of the page)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。