Interactive Conditional Menus
Live Demo
This script will allow you to create multi-level menu choices, without forcing the user to reload the page.
First, click here to see how what we're talking about.
We do this by creating two menus - the choice made in the first will interactively determine what appears in the second.
In this example, we'll imagine a web site with code samples in several languages (what a good idea) and the choice in the second menu displays tutorials appropriate to the language selected in the first.
So, first here's the code to create the two menus:
When a language is selected in the first menu, the onChange event is called. Now we need to look at the Javascript to see how we will handle this.
First, we need to create some arrays:
|
Now three functions will complete the script:
|
click here to see how it looks in practice.
|
Useful Links

|
|