获取滚动条高度

 

Code
function getScrollTop() {   
        
var scrollPos = 0;    
        
if (typeof window.pageYOffset != 'undefined') {    
           scrollPos 
= window.pageYOffset;    
        }    
        
else if (typeof window.document.compatMode != 'undefined' &&    
           window.document.compatMode 
!= 'BackCompat') {    
           scrollPos 
= window.document.documentElement.scrollTop;    
        }    
        
else if (typeof window.document.body != 'undefined') {    
           scrollPos 
= window.document.body.scrollTop;    
        }    
        
return scrollPos;   
    }  

 

posted @ 2009-05-21 10:49  飞越梦想  阅读(728)  评论(0)    收藏  举报