<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<script type="text/javascript">
//法一
document.write("///******法一******///"+"<br />");
document.write(document.body.scrollWidth+"<br />");
document.write(document.body.scrollHeight);
//法二
var w=document.documentElement.scrollWidth;
var h=document.documentElement.scrollHeight;
document.write("<br>"+"///******法二******///"+"<br>"+"宽为:"+w+"<br>"+"高为:"+h);
var a=document.documentElement.scrollWidth
|| document.body.scrollWidth;
var b=document.documentElement.scrollHeight
|| document.body.scrollHeight;
document.write("<br>"+"///******法三******///"+"<br>"+"宽为:"+a+"<br>"+"高为:"+b);
</script>
</body>
</html>运行结果:

有些只识别document.body.scrollWidth;有些识别var document.documentelement.scrollWidth;
同一个浏览器 在绝大部分情况下 是一样的
浏览器兼容的问题吧!