|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
PLEASE HELP ME!!!!!
I've got 3 drop down lists. The first one changes what appears in the second two. For some reason the code below is only deciding to show me the first two items that appear in the two drop down lists in question. So, this leads me to believe the problem shuld be quite simple to solve! but i've been stuck on it for a couple of hours now! If someone could help me out here I'd be extremely extremely greatful!!!! <select name="free_item" onchange="relate(this.form)"> <option selected value="0">--Please select--</option> <option value="test1">test product1</option> </select> <SCRIPT LANGUAGE="JavaScript"> <!-- // Dynamic product sizes + colours var supported = (window.Option) ? 1 : 0; if (supported) { var active; var opt = new Array(); opt[0] = new Array(); opt[0][0] = new Array(); opt[0][1] = new Array(); opt[0][0][0] = new makeOption(" - - ", " - - "); opt[0][1][0]= new makeOption(" - - ", " - - "); opt[0][0][1] = new makeOption(" - - ", " - - "); opt[0][1][1]= new makeOption(" - - ", " - - "); opt[1] = new Array(); opt[1][0] = new Array(); opt[1][1] = new Array(); opt[1][0][0] = new makeOption("Size", "Size"); opt[1][0][1] = new makeOption("Small", "Small"); opt[1][0][2] = new makeOption("Medium", "Medium"); opt[1][0][3] = new makeOption("Large", "Large"); opt[1][0][4] = new makeOption("Ex-Large", "Ex-Large"); opt[1][1][0] = new makeOption("Colour", "Colour"); opt[1][1][1] = new makeOption("Black", "Black"); opt[1][1][2] = new makeOption("White", "White"); opt[1][1][3] = new makeOption("Blue", "Blue"); } function makeOption(text, view_opt) { this.text = text; this.view_opt = view_opt; } function relate(form) { if (!supported) { load(form, "free_item"); load(form, "free_colour"); return; } var options = form.free_size.options; for (var i = 1; i < options.length; i++) { options[0][i] = null; } var curAr = opt[form.free_item.selectedIndex]; for (var j =0; j < curAr.length; j++) { options[j] = new Option(curAr[0][j].text, curAr[0][j].view_opt); } options[0].selected = true; var options = form.free_colour.options; for (var i =1; i < options.length; i++) { options[i] = null; } var curAr = opt[form.free_item.selectedIndex]; for (var j = 0; j < curAr.length; j++) { options[j] = new Option(curAr[1][j].text, curAr[1][j].view_opt); } options[0].selected = true; } function load(form, name) { var view_opt = form[name].options[form[name].selectedIndex].value; return false; } // --> </SCRIPT> <b>Size : </b> <font face="arial" size="2"> <select name="free_size"> </select> <b>Colour : </b> <select name="free_colour"> </select> </form> Right that's it. See what you can do! andyd@domino.com |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Dynamic drop down lists |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|