Mega Code Archive

 
Categories / JavaScript Tutorial / HTML Tags
 

Report document body scrollLeft and document body scrollTop

< html>     <head>         <title>OnScroll Example</title>         <script type="text/javascript">             window.onscroll = function () {                 var oTextbox = document.getElementById("txt1");                 oTextbox.value += "\nscroll is at " + document.body.scrollLeft + " horizontally and " + document.body.scrollTop + " vertically.";             }         </script>     </head>     <body>          <P><textarea rows="15" cols="50" id="txt1"></textarea>          <P>Try scrolling this window.</p>     </body> </html>