<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru" dir="ltr">
<head>
</head>
<body style="height:7800px;">
<p> </p>...<p> </p><!-- отступы -->
<div id='id' style="border:red solid 1px;min-width:42px;position:fixed;top:30%">0</div>
<p> </p>...<p> </p><!-- еще отступы -->
<script type="text/javascript">
var html=document.documentElement,body=document.body;
function addEvent(el,type,fun){
if(el.addEventListener){el.addEventListener(type,fun,false);}
else if(el.attachEvent){el.attachEvent('on'+type,fun);}
}
function getScrollTop(){
var a;
if(window.pageXOffset!=undefined){a=pageYOffset;}
else a=(html.scrollTop||body&&body.scrollTop||0)-html.clientTop;
document.getElementById('id').innerHTML=a;
}
addEvent(window, 'DOMMouseScroll',function (){setTimeout('getScrollTop()',12)});/* Gecko */
addEvent(window, 'mousewheel',function (){setTimeout('getScrollTop()',12)});/* Opera */
addEvent(document, 'mousewheel',function (){setTimeout('getScrollTop()',12)});/* IE */
</script>
</body>
</html>