I'm looking for at so开发者_如何转开发lution to make document.body.scrollTop return the right values when using a doctype
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
now this only works with chrome and not in ff and ie
alert('scrollTop = '+document.body.scrollTop);
I think these are the two alternatives:
var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
精彩评论