JavaScript City



Drop Box with Button

This script will allow you to add a drop-down box navigation system that will change pages when the viewer makes a selection and clicks the button.

Script Code

Grab a copy of the file below and place it in the same directory as the Web page on which you will use the script (if you wish to place the script file in a different directory you will need to make the necessary adjustments to the src attribute of the script tag that calls it).

snavb3.js

The code below should be placed between the <body> and </body> tags where you want the drop-box to appear.

Example

A working sample of the script is shown below.

  

Options

You can change the appearance of the drop-down box and the button by adding the my_links id and sub_nav id to your style sheet and editing as desired.

To edit the destinations and menu text, edit the HTML code as needed within the <option></option> tags. To edit the text of the button, edit it's value attribute (default is Go!).

Additional drop-down choices can be added by adding additional <option></option> tags with the necessary information.

Accessibility

A backup to the script via a server-side script that does the same thing should suffice. If that is not possible, offering the user the ability to navigate the site another way would be helpful.



eXTReMe Tracker