百度首页 | 百度空间
 
查看文章
 
JS获取网页高度及屏幕分辨率高度让DIV层始终在页面最底部
2008-05-16 14:00

<html>
<head>
<title>DIV层始终在页面最底部</title>
<script type="text/javascript">
var heighttemp = 400;
function changeHeight()
{
var temp = document.getElementById("tableid");
heighttemp = heighttemp +100;
temp.style.height = heighttemp;
}
</script>

</head>
<body leftmargin="0" topmargin="0">
<table width="100%" height="405" bgcolor="#eeeeee" id="tableid" onclick="changeHeight()">
<tr>
<td>
JS获取网页高度及屏幕分辨率高度让DIV层始终在页面最底部,点击这里增加table高度--点击一次增加100px
</td>
</tr>
</table>
<div id="t1" style="position:absolute;border:double;width=500">
这个是底部div,会一直在网页底部.....
</div>
<script language="javascript">
//document.all.t1.style.top = document.body.clientHeight;
var h1 = window.screen.availHeight-165;
if (document.body.clientHeight<h1)
   document.all.t1.style.top = window.screen.availHeight-165;
//document.write ("当前窗口宽:"+document.body.offsetWidth+"; 高:"+document.body.clientHeight+"aaaa"+(window.screen.availHeight));

</script>
</body>
</html>


类别:Javascript | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码:
 

     

©2008 Baidu