Ver Mensaje Individual
  #7 (permalink)  
Antiguo 03/10/2009, 07:54
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 18 años, 1 mes
Puntos: 126
Respuesta: Consulta...Muestre un select dependiente de otro select

Hola

La solución que planteas es totalmente válida. Pero y si no sabes la cantidad de elementos, por que se crearán dinámicamente, entonces deberías de usar esta otra función

Código javascript:
Ver original
  1. var valor = null;
  2. function funcion(elem) {
  3.   obj = document.getElementById(elem);
  4.   obj.style.display = (obj==valor) ? 'none' : 'block';
  5.   if (valor != null)
  6.     valor.style.display = 'none';
  7.   valor = (obj==valor) ? null : obj;
  8. }


Código html:
Ver original
  1. onchange = "funcion(document.getElementById(this.options[this.selectedIndex].value))"

Suerte
__________________
Los formularios se envían/validan con un botón Submit
<input type="submit" value="Enviar" style="background-color:#0B5795; font:bold 10px verdana; color:#FFF;" />