Javascript: make web browser scroll up?

What is javascript to scroll at the top when a button / link / etc. clicked?

+3
source share
3 answers
<a href="javascript:scroll(0, 0)">Top</a>
+5
source

If you have an anchor link at the top of the page, you can also do this with anchors.

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

It will work in a browser with Javascript disabled, but changes the URL. :( It also allows you to jump anywhere where the name anchor is installed.

+4
source

, , .

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

"" hashname, .

, "" .

<a href="/">reload</a>
0

Source: https://habr.com/ru/post/1696720/


All Articles