Michael Goebel
Michael Goebel

Reputation: 31

How to automatically Scroll a text window on loading it

I have a html text box with scroll. Is it possible to get the box to scroll to a certain point on loading ?

Upvotes: 3

Views: 363

Answers (2)

Khoa Nguyen
Khoa Nguyen

Reputation: 1317

You can use scrollTop

document.getElementById('your_div_id').scrollTop = 50;

Upvotes: 3

Naftali
Naftali

Reputation: 146302

you can use an id on a certain point in the text:

<span id='scrollTo'>lorem ipsum...</span>

and then in the URL:

localhost/index.html#scrollTo

or:

if you want to go the javascript route you can use the jquery $.scroll method

Upvotes: 0

Related Questions