windstore

 

javascript获取滚动条位置

<script type="text/javascript">
function getScroll()  {    
var t, l, w, h;        
if (document.documentElement && document.documentElement.scrollTop) {          
   t = document.documentElement.scrollTop;
  l = document.documentElement.scrollLeft;      
  w = document.documentElement.scrollWidth;        
  h = document.documentElement.scrollHeight;    
} else if (document.body) {        
  t = document.body.scrollTop;      
  l = document.body.scrollLeft;        
  w = document.body.scrollWidth;        
  h = document.body.scrollHeight;    
}
    
return { t: t, l: l, w: w, h: h };
}
</script>

posted on 2009-10-23 21:30  清虚真人  阅读(505)  评论(0编辑  收藏  举报

导航