Javascript获取页面滚动条的位置

Javascript获取滚动条的位置.(代码来源于网络)

js
function getScroll()  {     
var t, l, w, h;          
if (document.documentElement && document.documentElement.scrollTop) {         
= document.documentElement.scrollTop;         
= document.documentElement.scrollLeft;         
= document.documentElement.scrollWidth;         
= document.documentElement.scrollHeight;     
else if (document.body) {
= document.body.scrollTop;         
= document.body.scrollLeft;         
= document.body.scrollWidth;         
= document.body.scrollHeight;     
}     
return { t: t, l: l, w: w, h: h }; 
}  
posted @ 2008-12-10 11:40  KenBlove  阅读(914)  评论(0编辑  收藏  举报