代码如下
function calc_scroll_xy()
{
_browser_scroll_x = 0;
_browser_scroll_y = 0;
if( typeof( window.pageyoffset ) == 'number' )
{
//netscape compliant
_browser_scroll_y = window.pageyoffset;
_browser_scroll_x = window.pagexoffset;
} else if( document.body && ( document.body.scrollleft || document.body.scrolltop ) )
{
//dom compliant
_browser_scroll_y = document.body.scrolltop;
_browser_scroll_x = document.body.scrollleft;
}
else if( document.documentelement && ( document.documentelement.scrollleft || document.documentelement.scrolltop ) )
{
//ie6 standards compliant mode
_browser_scroll_y = document.documentelement.scrolltop;
_browser_scroll_x = document.documentelement.scrollleft;
}
}