document.documentElement返回的是html元素,它是只读的。body返回的就是body元素.elem = document; doc = elem.documentElement; // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);获取页面高度jquery是这么实现的,取几个的最大值能解决一些兼容性等的问题。