Connecting Tech Pros Worldwide Help | Site Map

Looking for script?

Arthur Pratz
Guest
 
Posts: n/a
#1: Jul 20 '05
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,
Mike Pratz


Ivan Marsh
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Looking for script?


On Fri, 21 Nov 2003 20:26:12 +0000, Arthur Pratz wrote:
[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,
> Mike Pratz[/color]

Doesn't sound like you're describing a script so much as an HTML anchor.

<A NAME='MIDDLEOFTHEPAGE>you are now at the middle of the page</A>

<A HREF="www.mysite.com#MIDDLEOFTHEPAGE">


--
i.m.
The USA Patriot Act is the most unpatriotic act in American history.

Michael Winter
Guest
 
Posts: n/a
#3: Jul 20 '05

re: Looking for script?


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)
Michael Winter
Guest
 
Posts: n/a
#4: Jul 20 '05

re: Looking for script?


Ivan Marsh wrote on 21 Nov 2003:
[color=blue]
> <A NAME='MIDDLEOFTHEPAGE'>you are now at the middle of the page</A>[/color]
^

The id attribute is preferable. Although the range of characters that
can constitute the value is limited, the id attribute can be used
with any BODY level element (except SCRIPT), so you aren't restricted
to linking to anchor elements.
[color=blue]
> <A HREF="www.mysite.com#MIDDLEOFTHEPAGE">[/color]
^

Absolute URIs should always specify the protocol.

Mike

--
Michael Winter
M.Winter@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Closed Thread


Similar JavaScript / Ajax / DHTML bytes