JS获取网页高度及屏幕分辨率高度让DIV层始终在页面最底部
www.diybl.com 时间 : 2010-11-18 作者:佚名 编辑:fnw 点击: [ 评论 ]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JS获取网页高度及屏幕分辨率高度让DIV层始终在页面最底部</title>
</head>
<body leftmargin="0" topmargin="0">
<table width="100%" height="405" bgcolor="#eeeeee">
<tr>
<td>
aaa
</td>
</tr>
</table>
<div id="t1" style="position:absolute;border:double;">
aaaaaaa
</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>