codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:


Home » Javascript » Article

Interactive Conditional Menus

Article by:  Jeff Anderson  ( 1362 ) (5/3/2002)
Bookmark us now! Add to Favourites
Email a friend!Tell a friend
Sponsored by: Neil Matthews Hypnotherapy, Wilmslow
Summary: Interactive, conditional Javascript menus. The user makes choices in one select menu which then populates the choices in the second menu.
Viewed: 16075 times Rating (1 vote): 
 5 out of 5
 Rate this Article  Read Comments  Post Comments

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:

Select All Code


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:

Select All Code


Now three functions will complete the script:

Select All Code


click here to see how it looks in practice.






CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
Rate this article:     Poor Excellent
View highlighted Comments
User Comments on 'Interactive Conditional Menus'
Posted by :  mhsrinivasan at 11:12 on Sunday, March 26, 2006
The Live Demo Doesn't work for IE6.0 and Mozilla Firefox 1.5
Posted by :  bintababe at 11:57 on Tuesday, October 23, 2007
Hello my dear
compliment of the day.
my name is Binta,i am happy to contact you with all my heart,sorry to hear that a girl like me is searching for love,but i believe and i think that we can make it together,please i will like you to email me back if you real interested in my love, I believe we can move from here. I will be waiting to receive your lovely reply soonest,where i can give you my picture for you to know whom i am please contact back also with love from your heart,
thanks with love from my heart.
Binta


To post comments you need to become a member. If you are already a member, please log in .

 



RELATED ARTICLES
Javascript - Enable and Disable form elements
by Jeff Anderson
This is a relatively little known and under-used feature of javascript which can be very useful in guiding a user through a form. Using the disabled tag, you can switch on and off elements in a form.
Javascript Onload Event
by Jeff Anderson
Sometimes you need to perform an action immediatley after the page has loaded. That's when the onLoad Event Handler comes in handy
Check IsNumeric Function
by Jeff Anderson
A javascript validation function to check whether the details entered by a user are numeric.
Form Validation Function
by Jeff Anderson
A javascript validation function that you can use to validate all types of forms.
JavaScript Field Is Empty Form Validation
by Jeff Anderson
This javascript function allows you to check whether a form field has been completed or not.
Javascript Get Selected Text
by Jeff Anderson
A cross-browser script to get text selected by the user
Check Email Validation Function
by Jeff Anderson
A javascript validation function to check whether the user has entered a valid email address in a form.
Validate Form and Disable Submit Button
by Marylou Marks
I have a form that validates info, but I also want to disable the submit button. The disable part worked before adding the form validating.
Multiple submit buttons on a single form
by Kiran Pai
This script shows you how to submit the contents of a form to different programs depending on which Submit button you press. Additionally it also shows how to call two different functions when you press the Submit button.
Simple date validation
by Chris Hogben
function that takes a date in three parts, day, month and year - returns true if it's a valid date.








Recent Forum Threads
• Re: Help Running VB script in Windows 2003
• ONUNLOAD
• Re: Insert Contents of .txt file into a .html page
• Re: Perl regular expression problem.
• Re: Problems in login using WWW::Mechanize
• searching for gd::graph guide
• Re: ARRAY OF HASHMAPS
• Adv. Regexp or Otherwise
• Adv. Regexp or Otherwise


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008