ciao a tutti!
ho trovato il seguente script su internet ma non mi funziona. sapete aiuarmi a trovare l errore perfavore?
codice:<html> <head> <SCRIPT LANGUAGE="JavaScript"> <!-- function setOptions(chosen) { var selbox = document.myform.gruppo; selbox.options.length = 0; if (chosen == " ") { selbox.options[selbox.options.length] = new Option('GRUPPO',' '); } if (chosen == "A Meccanico") { selbox.options[selbox.options.length] = new Option('A ferro','A ferro'); selbox.options[selbox.options.length] = new Option('B acciaio','B acciaio'); selbox.options[selbox.options.length] = new Option('C acciaio Inox','C acciaio Inox'); selbox.options[selbox.options.length] = new Option('D alluminio','D alluminio'); } if (chosen == "B Pneumatico") { selbox.options[selbox.options.length] = new Option('A Cilindri','A Cilindri'); selbox.options[selbox.options.length] = new Option('C Basi','C Basi'); selbox.options[selbox.options.length] = new Option('E Fine corsa','E Fine corsa'); selbox.options[selbox.options.length] = new Option('F Accessori','F Accessori'); selbox.options[selbox.options.length] = new Option('J Sensori ','J Sensori '); selbox.options[selbox.options.length] = new Option('K vuoto','K vuoto'); } } --> </script> </head> <body> <form name="myform"> <select name="categoria" size="1" onchange="setOptions(document.myform.categoria.options[document.myform.categoria.selectedIndex].value);"> <option value="" selected="selected">CATEGORIA</option> <option value="A Meccanico">A Meccanico</option> <option value="B Pneumatico">B Pneumatico</option> </select> <select name="gruppo" size="1"> <option value=" " selected="selected">GRUPPO</option> </select> <input type="button" name="go" value="Value Selected" onclick="alert(document.myform.gruppo.options[document.myform.gruppo.selectedIndex].value);"> </form> . . . </body> </html>

Rispondi quotando