为什么明明是一样的scrollHeight 输出的高度却不一样呢?
<!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>运行结果:
