that is not javascript, but just plain HTML
that is called a dynamic anchor. where you want the link to point simply put:
<a name="top"> </a>
where top is the name of the anchor.
To point to it, use:
<a href="#top">go to top</a>
the hash indicates that it is on the same page.
i hope this is of some use to you