Mega Code Archive

 
Categories / JavaScript Tutorial / Window
 

Window pageYOffset

The pageYOffSet property reflects the current vertical pixel location of the top-left corner of the document. <html>     <head>     <script language="JavaScript1.2">     <!--     function showLocation(){       var x = self.pageXOffset;       var y = self.pageYOffset       var currX = "X-coordinate: " + x + "\n";       var currY = "Y-coordinate: " + y;       window.alert(currX + currY);     }     -->     </script>     </head>     <body>     <form>       <input type=BUTTON value="Show Location" onClick="showLocation()">     </form>     </body>     </html>