Feedback on: Dropdown Menus #3
Worth:
Very worth reading
Comments:
This is good
Comments:
Here's the answer to your challenge (although I bet others have answered it better :-) -
<HTML>
<HEAD>
<TITLE>Magic Select</TITLE>
<SCRIPT LANGUAGE="JavaScript"></SCRIPT>
</HEAD>
<BODY>
<INPUT TYPE="Text" NAME="text" SIZE="16"
ONKEYUP="matchSelect (value, countries, 3);"
ONBLUR="if (countries.selectedIndex > 0) { value = countries.item(countries.selectedIndex).value; }"
>
<BR>
<SELECT NAME="countries" SIZE="5"
ONBLUR="if (selectedIndex > 0) { text.value = item(selectedIndex).value; }"
>
<OPTION VALUE="">
<OPTION VALUE="Argentina">Argentina
<OPTION VALUE="Australia">Australia
<OPTION VALUE="Austria">Austria
<OPTION VALUE="Belgium">Belgium
<OPTION VALUE="Bermuda">Bermuda
<OPTION VALUE="Bolivia">Bolivia
<OPTION VALUE="Brazil">Brazil
<OPTION VALUE="Brunei Darussalam">Brunei Darussalam
<OPTION VALUE="Canada">Canada
<OPTION VALUE="Caribbean">Caribbean
<OPTION VALUE="Chile">Chile
<OPTION VALUE="China">China
<OPTION VALUE="Colombia">Colombia
<OPTION VALUE="Croatia">Croatia
<OPTION VALUE="Czech Republic">Czech Republic
<OPTION VALUE="Denmark">Denmark
<OPTION VALUE="Estonia">Estonia
<OPTION VALUE="Europe">Europe
<OPTION VALUE="Finland">Finland
<OPTION VALUE="Former USSR">Former USSR
<OPTION VALUE="France">France
<OPTION VALUE="Germany">Germany
<OPTION VALUE="Greece">Greece
<OPTION VALUE="Hong Kong">Hong Kong
<OPTION VALUE="Hungary">Hungary
<OPTION VALUE="Iceland">Iceland
<OPTION VALUE="India">India
<OPTION VALUE="Indonesia">Indonesia
<OPTION VALUE="Ireland">Ireland
<OPTION VALUE="Israel">Israel
<OPTION VALUE="Italy">Italy
<OPTION VALUE="Japan">Japan
<OPTION VALUE="Korea">Korea
<OPTION VALUE="Latin America">Latin America
<OPTION VALUE="Luxemburg">Luxemburg
<OPTION VALUE="Macedonia">Macedonia
<OPTION VALUE="Malaysia">Malaysia
<OPTION VALUE="Mexico">Mexico
<OPTION VALUE="Middle East">Middle East
<OPTION VALUE="Netherlands">Netherlands
<OPTION VALUE="New Zealand">New Zealand
<OPTION VALUE="North Africa">North Africa
<OPTION VALUE="Norway">Norway
<OPTION VALUE="Peru">Peru
<OPTION VALUE="Philippines">Philippines
<OPTION VALUE="Poland">Poland
<OPTION VALUE="Portugal">Portugal
<OPTION VALUE="Russia">Russia
<OPTION VALUE="Russian Federation">Russian Federation
<OPTION VALUE="Singapore">Singapore
<OPTION VALUE=""Slovak Republic>Slovak Republic
<OPTION VALUE="Slovakia">Slovakia
<OPTION VALUE="Slovenia">Slovenia
<OPTION VALUE="Slovenija">Slovenija
<OPTION VALUE="South Africa">South Africa
<OPTION VALUE="South Korea">South Korea
<OPTION VALUE="Spain">Spain
<OPTION VALUE="Sweden">Sweden
<OPTION VALUE="Switzerland">Switzerland
<OPTION VALUE="Taiwan">Taiwan
<OPTION VALUE="Thailand">Thailand
<OPTION VALUE="Turkey">Turkey
<OPTION VALUE="United Kingdom">United Kingdom
<OPTION VALUE="United States">United States
<OPTION VALUE="Uruguay">Uruguay
<OPTION VALUE="Venezuela">Venezuela
<OPTION VALUE="Yugoslavia">Yugoslavia
</SELECT>
</FORM>
<BR><BR>
<A HREF="mailto:wilba@bigfoot.com">Alan Williams</A>, March 2000
</BODY>
</HTML>
Comments:
Nowhere can I find a way to set the value in second option list, based on a choice in a first option list. Assume option list 1 is the primary categories, then option list 2 displays the sub-categories, depending on which major category you chose in list1. Please explain how to do this.
e.g.
Option list1 -- fish, cats, dogs
option list2 -- for fish: cod, sole, mackrel;
for cats -- calico, persian, tabby
for dogs -- spaniel, dane, collie.
Get the idea? This is an important use of option lists, but no one has explained how to "stack" them to call each other.