Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to make a page start at the bottom when loaded?

Status
Not open for further replies.

Murley

Programmer
Jan 9, 2002
14
US
Hello all, I'm looking for a way to use javascript to tell a page to start at the bottom when loaded. The user could then use the scroll bar to scroll back up, but i'd like it to start at the bottom.?

I havn't found anythign like this, could someone possibly provide me with a short peice of code to do this?

Any help is very appreciated. Regards,

Chris Murley
Systems Administrator\Programmer
 
put an anchor at the bottom of your page.

eg. <a name=&quot;bottom&quot;></a>

then make the link to the page include the anchor. eg.

your_page.html#bottom

or reload your page with

window.location.href=&quot;your_page.html#bottom&quot;
 
You could try using window.scrollTo(x-axis, y-axis) in IE in a <body onload=scrollPage()> function that runs after the page is loaded. You can use an arbitrarily large number for the y-axis value (zero for the x-axis value) to make sure you reach the bottom of the page, or you could be more elegant by calculating the page height minus the window height and using that value. Good Luck!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top