<!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">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<div style="height:1500px;"></div>
<input type="button" value="Get scrollHeight" onClick="alert(document.body.scrollTop);" />
<div style="height:500px;"></div>
</body>
</html>
再看下面:
<htmL>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<div style="height:1500px;"></div>
<input type="button" value="Get scrollHeight" onClick="alert(document.body.scrollTop);" />
<div style="height:500px;"></div>
</body>
</html>
这样取值就正确了,两个文件就<meta>以上不同,其他都一样
怎样做才能在xhtml里取道正确的scrollTop