View Full Version : make a button put page to top?

05-03-2009, 08:52 PM

I want a button on my site that says "top of page", and it moves the user to the top of the page they are on?

I'm not sure what to search on google so i dont no how to do it.

Please could someone show me?


05-03-2009, 09:00 PM
Hello sphinx1994,
Your wanting an anchor tag. Have a look here - http://www.scribblegraphics.com/articles/articles-anchors.html or google for more examples.

05-04-2009, 11:47 AM
i used this,( i put on the top of my page):

<a name="#top"></a>

and this link @ the bottom of the page:

<a href="#top">Top of page</a>

when i click the link it still doesnt put me to the top of the page,,
what have i done wrong?

05-04-2009, 11:57 AM
You should not use name attributes for creating such anchors, which is deprecated. use id attribute instead. In that way you can set anchor to any element, and don't actually need to create an extra empty anchor. Say

<h1 id="header">Site Heading</h1>

<a href="#header">Go to top</a>
Refer http://www.w3.org/TR/REC-html40/struct/links.html#h-12.2.3