What is the Javascript to scroll to the top when a button/link/etc. . . clicked?
+4
A:
If you had an anchor link at the top of the page, you could do it with anchors too.
<a name="top"></a>
<a href='#top">top</a>
It'll work in browser's with Javascript disabled, but changes the url. :( It also lets you jump to anywhere the name anchor is set.
Rob Rolnick
2008-09-08 00:46:44
A:
actually, this works by itself, no need to define it.
<a href="#top">top</a>
This is a "magic" hashname value that does not need to be defined in browsers.
Just like this will "reload" the page.
<a href="/">reload</a>
scunliffe
2008-09-16 01:42:41