Arthur Pratz wrote on 21 Nov 2003:
[color=blue]
> Hi all,
> I am looking for a script that Upon clicking a hyperlink,
> Dependind on which one in my menu, It will take me to the page,
> but then move or scroll automatically down to the part they
> click on. I know I didnt describe it good, but I know the
> scripts are out there because I have seen them, Just dont know
> the correct term. Any help appreciated,[/color]
If you are scrolling to the beginning of a structural or content
element (such as the heading of some text, or an image), what I'm
going to suggest below should be sufficient. If not, you'll need to
be a bit more specific (about both the menu and the content you're
linking to).
You should be able to do this simply with id attributes and fragment
identifiers. Unless you are using a drop-down menu (you didn't
specify the type of menu), you don't even have to use JavaScript.
As the id attribute is a core attribute, it exists in every BODY
level element, except in-line SCRIPTs. Place id attributes in the
locations that you will target (scroll to), then use a relative URI:
<A href="#the_target_id">...</A>
If the target is in another document, then add the filename before
the hash (#).
If you are using a drop-down menu, it's very similar:
window.location = '#the_target_id';
or
window.location = 'the_file.html#the_target_id';
Mike
--
Michael Winter
M.Winter@blueyonder.co.uk.invalid (remove ".invalid" to reply)