Click to See Complete Forum and Search --> : jump from form


Cassius
10-12-2006, 08:22 AM
I have a form at the top of a page which consists of just 1 field which contains a list of values. When a user selects a value from this field, i would like that the user will be taken to the section within that page based on the value chosen. How do i do about this ?

I normally use the onChange event, using the document.location.href when i need to take the user to another page, but not sure if it is possible to use the same manner in this instance, since i am simply scrolling down on the same page.

Thanks for any info.

ray326
10-12-2006, 01:17 PM
Put IDs on the headings for your sections and use #fragments to jump to them.

<h4 id="sect10">Section 10</h4>

document.location.href="#sect10"

Cassius
10-13-2006, 02:13 AM
thanks for your reply. it worked out a treat.

However, i have one further issue which i would like to address, if it is possible.

When i select a value, the page jumps correctly to that fragment, however the chosen fragment appears at the bottom of the page. Is it possible to make it appear at the top of the browser window, so that i can see the text underneath it, instead of any contents above it ?

Thank You

ray326
10-13-2006, 03:40 PM
That's up to the browser but I guess I've never seen it work any way but the way you want -- link at the top.

Kravvitz
10-13-2006, 04:15 PM
You can make it appear at the top with JavaScript, but I don't think I have time to make a demo today.

I'll try to remember to come back to this when I have time.