How to automatically take the user to the bottom of the page?

Associate
Joined
6 Jan 2006
Posts
1,024
Location
Midlands
Hi
Ive made a page which is very long in height. i want everytime the user loads the page, it takes them down to the bottom of the page automatically. i know about anchor but it requires the user to type extra info.

How can i do it so whenever the user types www.blahblah.com the page loads and take them to the bottom of the page using just html or javascript.

thanks
 
If its for one page then use the <a name="bottom"></a> at the bottom
put the page inside a frame with the source as page.html#bottom

If its for more than one, or dynamic pages then you should be able to do an onload statment to document.href (i cant remember the code off the top of my head) to page.html#bottom
 
Code:
function goToBottom()
{
	var body = document.getElementsByTagName('body')[0];
	body.scrollTop = body.scrollHeight;
}

window.onload = goToBottom;
 
psyr33n said:
Code:
function goToBottom()
{
	var body = document.getElementsByTagName('body')[0];
	body.scrollTop = body.scrollHeight;
}

window.onload = goToBottom;

thanks a lot psyr33n, works great
 
Back
Top Bottom