Se puede hacer
así, pero a mí me gusta más de otra manera.
Por ejemplo:
Código Javascript
:
Ver original<script type='text/javascript'>
function selects(){
nada = '- - - Esperando selección - - -';
futbol = new Array('Madrid', 'Barça');
basket = new Array('Chicago Bulls', 'Bucks');
voley = new Array('Voley internacional', 'Voley nacional');
primero = document.getElementById('selecc');
segundo = document.getElementById('selecc2');
switch(primero.value){
case '-':
segundo.length = 1
segundo.options[0].value = '-';
segundo.options[0].text = nada;
segundo.disabled = true;
break;
case 'futbol':
segundo.length = futbol.length;
for(i = 0; i<futbol.length; i++){
segundo.options[i].value = futbol[i];
segundo.options[i].text = futbol[i];
}
break;
case 'basket':
segundo.length = basket.length;
for(i = 0; i<basket.length; i++){
segundo.options[i].value = basket[i];
segundo.options[i].text = basket[i];
}
break;
case 'voley':
segundo.length = voley.length;
for(i = 0; i<voley.length; i++){
segundo.options[i].value = voley[i];
segundo.options[i].text = voley[i];
}
break;
}
if(primero.selectedIndex!=0){
segundo.disabled = false;
}
}
</script>
Y en el HTML:
Código HTML:
Ver original<form name='a1' action='' method="post"> <select id='selecc' onchange='selects();'> <option value='-' selected='selected'>-Seleccione...-
</option> <select id='selecc2' disabled='disabled'>
Saludos (: