menus and anchors

They have: 4 posts

Joined: May 2005

im wondering how to set an anchor link from a drop down menu to a line on the same page. im using dreamweaver, but if anyone knows how to just code it manually, thats great too.

so this is how its laid out:
its an "athletics" page for my high school, and there are about 15 tables each with the name of a sport, the coach, and a brief paragraph of information. At the top of the page i have a drop down menu with all of the sports and what i want to have happen is when someone chooses a sport from the drop down, it brings them to the table with the info they want.

I know how to use anchors from regular links, but i've never done this from a drop down menu.

please help, its driving me mad, thanks so much

He has: 388 posts

Joined: Apr 2005


<form name="navigateform" width="160">
    <select align="right" name="navigatelinks" onchange="window.location=document.navigateform.navigatelinks.options[document.navigateform.navigatelinks.selectedIndex].value">

        <option>Navigate</option>
    <option value="http://www.yy2.com/Nazi%20skates/YaBB.pl">FORUM
</option>

    <option value="http://www.yy2.com/Nazi%20skates/YaBB.pl?board=news">Skate talk</option>
    <option value="http://www.yy2.com/Nazi%20skates/YaBB.pl?board=music">Music talk</option>

    <option value="http://www.yy2.com/Nazi%20skates/YaBB.pl?board=gen">Talk</option>
   
    <option value="music.html">Music</option>
   
    <option value="http://naziskates.111mb.com/articles/articlelist_main.html">ARTICLES</option>
    <option value="http://naziskates.111mb.com/articles/what_if_main.html">Home</option>
  <option value="http://naziskates.111mb.com/articles/Tsunami_benafit_demo_main.html">Tsunami benafit demo</option>

    <option value="login.html">Members area</option>
    <option value="reg.html">Register</a>
</select>
</form>

'

Forgive the links already in it but i just took it from one of my pages
All you do is put the url in the value of the option and what you want the link to say in between the option and the /option tags

now for linking to the same page just do what you would do for an ordinairy link

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

It's as simple as this:
First go to the tables (or headings in the example below) and create a tags with meaningful names in the place that you want the links to lead to.

<h2><a name="placeonpagetolink">This is the place the page will jump to</a></h2>
'
Then in the menu create the links (as below):
<a href="#placeonpagetolink">Go to place on Page</a>
'

a Padded Cell our articles site!

They have: 4 posts

Joined: May 2005

ok...what is this?

i copied and pasted vibins' code into a blank page into dreamweaver and it worked fine, but when i do it to mine, it doesnt work.

this is my code, I don't see anything wrong, but it doesnt work!!! grrr

Choose a Sport
--FALL--
Cross Country
Football
Boys Golf
Boys Soccer
Softball
Girls Volleyball
Boys Tennis
--WINTER--
Wrestling
Boys Basketball
Girls Basketball
Girls Swimming
--SPRING--
Baseball
Track
Girls Golf
Girls Tennis
Girls Soccer
Boys Swimming
Boys Lacrosse
Girls Lacrosse
--YEAR LONG--
POMS
Cheerleading

i have anchors set, but the links dont go there!

please help!

They have: 4 posts

Joined: May 2005

i also copied vibins 'onchange' code to see if that was it, but it still didnt work

how does his code work but not mine? i'm copying his code to test but it doesn't work on my page.

Roo's picture

She has: 840 posts

Joined: Apr 1999

1) That's just a form...so you'd need a go buttom and the correct form tag to go with it.

2) For a dropdown that goes to links automatically when selected you need to use javascript.

I use one from Dynamic Drive on my weblog, here is is modified for your purpose:
<script language="JavaScript" type="text/javascript">

</script>

Nav Menu
Type Link Text
Type Link Text
Type Link Text
Type Link Text
Type Link Text

Roo

He has: 388 posts

Joined: Apr 2005

I dont understand why its not working for you it worked fine for me with no submit button needed.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.