本页主题: 获得页面宽高的问题 打印 | 加为IE收藏 | 复制链接 | 收藏主题 | 上一主题 | 下一主题

我是学生
今宵没的睡
级别: 江湖大侠


精华: 3
发帖: 762
威望: 571 点
财富: 40 K币
贡献值: 0 点
注册时间:2005-11-25
最后登录:2008-11-12

 获得页面宽高的问题

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
</body>
</html>
<script language="javascript">
<!--
alert(document.body.clientHeight);
//-->
</script>



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
</body>
</html>
<script language="javascript">
<!--
alert(document.body.clientHeight);
//-->
</script>

这两段代码只有定义的文档类型不同,而 获得的 页面 的 高度也不同,不论我用 clientHeight 、scrollHeight 还是 offsetHeight ,它在第一段代码中得到的高 都很小,不够页面全部。宽大概也是这样吧?

请问 用什么方法能得到 页面的全高和页面的全宽呢?
这个世界上只有两件事是最公平的:
1.每个人每天都只有24小时;
2.每个人都必须面对死亡.
-------------------------------------------------------------
本人长期受理动态ASP网页制作与修改,留言簿、论坛制作等业务。
我的邮箱 我的主页
顶端 Posted: 2008-08-29 15:14 | [楼 主]
jat
级别: 论坛版主


精华: 0
发帖: 543
威望: 627 点
财富: 16459 K币
贡献值: 0 点
注册时间:2004-10-14
最后登录:2008-11-04

 

document.documentElement.clientHeight
顶端 Posted: 2008-08-30 10:52 | 1 楼
我是学生
今宵没的睡
级别: 江湖大侠


精华: 3
发帖: 762
威望: 571 点
财富: 40 K币
贡献值: 0 点
注册时间:2005-11-25
最后登录:2008-11-12

 

呵呵。谢谢。
这个世界上只有两件事是最公平的:
1.每个人每天都只有24小时;
2.每个人都必须面对死亡.
-------------------------------------------------------------
本人长期受理动态ASP网页制作与修改,留言簿、论坛制作等业务。
我的邮箱 我的主页
顶端 Posted: 2008-08-30 11:45 | 2 楼
帖子浏览记录 版块浏览记录
IECN社区 » JavaScript/Ajax

Time now is:12-03 14:11, Gzip disabled 京ICP备06069722号
Powered by PHPWind v6.3.2 Certificate Code © 2003-08 PHPWind.com Corporation