Código:
El HTML de la lista:<script languaje="JavaScript"> <!-- provincias = new Array(); provincias[0] = new Array(); provincias[1] = new Array('Almería','Cádiz','Córdoba','Granada','Huelva','Jaén','Málaga','Sevilla'); provincias[2] = new Array('Huesca','Teruel','Zaragoza'); provincias[3] = new Array('Asturias'); provincias[4] = new Array('Baleares'); function cambiar(formulario){ var i = 0; var select1 = formulario['D1']; var select2 = formulario['D2']; var vector = provincias[select1.selectedIndex]; if(vector.length)select2.length=vector.length; while(vector[i]){ select2.options[i].value = vector[i]; select2.options[i].text = vector[i]; i++; } select2.options[0].selected = 1; } --> </script>
Código:
Gracias de Antemano <form method="POST"> <select name="D1" onchange="cambiar(this.form)"> <option>-</option> <option>Andalucía</option> <option>Aragón</option> <option>Asturias</option> <option>Baleares</option> </select> <select name="D2"> <option>-</option> </select></p> </form>