This code will execute the function fillCategory on load of the page and populate the category list box. Check the tutorial on adding options to a list box. The first list box is having a default option of category and others are added from the fillCategory function. You can change the options in fill category to get your list. Here is the code for the first list box
How to make one option as selectedIf we want to option Mango to be selected once the fruit is selected from first list then we have to add these lines inside adOption() function.
The present script can be modified further to develop multiple set of drop down boxes as per requirement. Here an introduction is only given on how to develop a client side dynamic drop down list box. You can get server side dynamic population of drop down box in our PHP tutorials.
Learn how the same drop down list is developed by taking data from Mysql table
This article is written by plus2net.com team.