---
title: "document.body.scrollTop的用法"
author: "guobinperfect"
date: "2011-04-21T20:46:21Z"
tags: []
categories: ["Web前端"]
slug: "document-body-scrolltop"
draft: false
lastmod: "2011-04-21T20:46:21Z"
id: 1011694
url: "https://guobinperfect.iteye.com/blog/1011694"
---

如果顶部申明

DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> 

document.body.scrollTop 
要改成 
document.documentElement.scrollTop