By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,397 Members | 1,370 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,397 IT Pros & Developers. It's quick & easy.

Navigation Problem

P: n/a
Hi,

This may be a simple problem, but i need some help on this.

When i load a new page, i want it to automatically navigate to a specific
position in the page. (like a hyperlink to a heading in the page)

How can i do this.

Thanks for your help
Rose Girl
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Rose Girl wrote:
Hi,

This may be a simple problem, but i need some help on this.

When i load a new page, i want it to automatically navigate to a specific
position in the page. (like a hyperlink to a heading in the page)

How can i do this.

Thanks for your help
Rose Girl

window.scrollto(x,y);

window.scrollto(0,0) will scroll to the top.

window.scrollto(0,1000) will scroll 1,000 pixels down.

To scroll to a specific element you'll need to calculate the position of
that element. There's a prettygood script here:
http://www.quirksmode.org/js/findpos.html

A much SIMPLER way to do this is to simply use the <A NAME="marker"></A>
tag and then at the bottom of your document put...

window.location.href="pagename.html#marker" where pagename.html is the
name of your page and #marker is the name of your name tag.

Good luck!

-------------
http://www.hunlock.com -- DHTML for the rest of us.
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.