View Full Version : Chained Selects - What do these 2 lines do?

09-21-2004, 03:57 PM
Script: http://www.dynamicdrive.com/dynamicindex16/chainedselects/chainedselects.html

In the following code snippet, what are the last two lines doing?

var hide_empty_list=true;

addListGroup("vehicles", "car-makers");

addList("car-makers", "Select a maker", "", "dummy-maker");
addList("car-makers", "Toyota", "Toyota", "Toyota");
addList("car-makers", "Honda", "Honda", "Honda");
addList("car-makers", "Chrysler", "Chrysler", "Chrysler", 1);

addList("dummy-maker", "Not available", "", "dummy-car");

addOption("dummy-car", "Not available", "");

09-21-2004, 07:32 PM
The 2nd to last line corresponds to the 2nd level select menu for the 1st level's first item ("Select A Maker"). In other words, choosing "Select a Maker" in turn results in the 2nd level menu showing "Not Available." The last line does the same for the 2nd level menu.

It's a little confusing, but you just need to look at it hard enough. :)