selecting HTML pages from drop down menu

Soldato
Joined
31 Oct 2005
Posts
8,842
Location
Leeds
pretty simple query, I'm a noob web site maker

I need a drop down menu on a page, that when you choose an option from the drop down menu, the page changes to that page

I.e menu

Index
Contact Us
Shop

and it will take you to the relevent page

nothing fancy, very basic

Cheers for any attempts
 
Here you go:-

Code:
<html>
<body>
<select onchange="location.href=this.options[this.selectedIndex].value;">
              <option selected>Quick Links</option>
              <option value="http://www.mysite.com/index.html">Index</option>
              <option value="http://www.mysite.com/contact.html">Contact Us</option>
              <option value="http://www.mysite.com/shop.html">Shop</option>
             </select>
</body>
</html>

Give you this

http://www.bournetechnology.co.uk/test.html

Obviously you need to chage the values there 'mysite.com' and the page names to suit your needs.

Enjoy
 
Last edited:
cheers for help

only problem is when I select something from the drop down menu nothing happens??

I've filled out the website paths in the code, do I need a submit button or something?:confused:
 
All that does it remove the need for a submit button. You could have the original one but as you say you'd need a some sort of action button which smells.

Hope it goes ok
 
Please bear in mind that the onchange event handler has accessibility issues -particularly for keyboard only users. IE will trigger the onchange event if the user tries to cycle through the select options with the up / down arrows before they have had a chance to see the options. A small "go" button alongside isn't a big price to pay to make your site friendlier.

For more info: http://www.google.co.uk/search?q=onchange+accessibility
 
Please bear in mind that the onchange event handler has accessibility issues -particularly for keyboard only users. IE will trigger the onchange event if the user tries to cycle through the select options with the up / down arrows before they have had a chance to see the options. A small "go" button alongside isn't a big price to pay to make your site friendlier.

For more info: http://www.google.co.uk/search?q=onchange+accessibility

This is very true, but who the hell uses a keyboard to navigate a website these days! :p
 
Back
Top Bottom