JavaScript to scroll to the top of the page

The following JavaScript link in your page will cause the page to scroll to the top:


<a href="javascript:scroll(0,0)">Top</a>


The first number is the x position, the second is the y position. (Positions are in pixels.)  So, you can also change these numbers to scroll to a specific point on a page, too.

Leave a comment