non php code

return to top link without bookmark

i saw this on leslie’s site. i never thought of it before. the conventional way to do a “return to top” link is create a bookmark with:

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

at the top of the page and then use:

<a href="#top">Return to Top</a>

to link it.

well there’s an easier way. this only works if you want to return to the very top of the page. it obviously does not replace the functionality of bookmarks.

<a href="#" onclick="window.scrollTo(0,0);return false;">Return to Top</a>

Since the latter one uses javascript therefore it will not work on browsers with javascript disabled.

5 thoughts on “return to top link without bookmark

  1. wow, that can come in handy, i regret adding 1000’s of back to top’s the old way now. haha. I’ve been a fan of your page forever, i love it 🙂

  2. Hey, thanks for that.. it works realy well.. I’m using it on my site now.. hehe… thank god I only have to edit only one file to change that.. or I will be (O.o)””

  3. We’re a group of volunteers and opening a new scheme in our community. Your site provided us with valuable information to work on. You’ve done a
    formidable job and our whole community will be thankful to you.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s