Use document.documentElement.scrollTop and document.body.scrollTop for cross-browser support.