You are here:About>Computing & Technology>JavaScript> Script Makers>        Drop Down Menu     
About.comJavaScript

Drop Down Menu

1. Introduction and Sample

clr gif
Join the Discussion

Questions? Comments?

One typical form of operation used in programs that you un on your computer is to have a menu bar across the top of the window with a series of drop down menus attached to it to select the function that you want to perform. This script allows you to add a menu bar to the top of the pages of your web site that your visitors can use to navigate your site.

To open a popup window showing an example menu so that you can see what this script can produce click here. Note that the links in this example don't actually go anywhere.

Everyone has different ideas about appropriate colours to use for their site. So that the menu blends in properly with your site you will have the opportunity to select the colours that you want to use for both the menu bar and the drop down menus when you generate the Javascript and CSS to go into the head section of your page.

As I have no idea of how many drop down menus you want or how many entries you want in each the script is generated with two example menus containing two entries each. You can easily edit the appropriate section of the code to set up the number of menus you require each with the required number of entries.

As not everyone is using a browser that supports dynamic HTML or even Javascript this script is set up to replace the drop down menus with a simple link to your site map page in those browsers that don't support it. You will need to supply the address of this page and the text that you use for the link when you generate the Javascript that goes into the body of your web page.

So let's get started. The first step is to generate the head script.

From Stephen Chapman,
Your Guide to JavaScript.
FREE Newsletter. Sign Up Now!
Newsletters & RSSEmail to a friendSubmit to Digg
 All Topics | Email Article | | |
Advertising Info | News & Events | Work at About | SiteMap | Reprints | HelpOur Story | Be a Guide
User Agreement | Ethics Policy | Patent Info. | Privacy Policy©2008 About, Inc., A part of The New York Times Company. All rights reserved.