in reply to HTML/Perl form question
And here is the call from your the controlling dropdown in this case it would be your categories.<script language="JavaScript" type="text/javascript"> var comm_list = new Array(); comm_list[0] = new Array("first", 34, 37); comm_list[1] = new Array("second", 35, 37); comm_list[2] = new Array("third", 36, 37); comm_list[3] = new Array("primary", 42, 38); comm_list[4] = new Array("secondary", 43, 38); </script> <script language="JavaScript" type="text/javascript"> function change_dd(parent, target, list){ var f = parent.form; var value = parent.options[parent.options.selectedIndex].value +; f.elements[target].options.length = 0; if(value == "0"){ var newopt = new Option('--- Select an Option ---', '0'); f.elements[target].options[f.element[target].options.lengt +h] = newopt; }else{ for(var i = 0; i < list.length; i++){ if(list[i][2] == value){ var newopt = new Option(list[i][0], list[i][1]); f.elements[target].options[f.elements[target].opti +ons.length] = newopt; } } } } </script>
A little explaination is in order eh?<select name="selection" onChange="change_dd(this, 'other_dd', comm_li +st)"> <option value="0">--- Select a Type ---</option> <option value="38">positional</option> <option value="37">numeric</option> </select> <select name="other_dd"> </select>
|
|---|