Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/11/2011, 15:04
el_quick
 
Fecha de Ingreso: julio-2010
Mensajes: 393
Antigüedad: 13 años, 9 meses
Puntos: 67
Respuesta: RadioButton y Select

Código HTML:
Ver original
  1.     .oculto{
  2.         display: none ;
  3.     }
  4.     .visible{
  5.         display: block ;
  6.     }
  7. <div id="contenedor_radios">
  8.     <label for="_opcion1">Opci&oacute;n 1:</label>
  9.     <input id="_opcion1" type="radio" name="opciones" name="opcion1" />
  10.     <br />
  11.     <label for="_departamento_radio">Departamento:</label>
  12.     <input id="_departamento_radio" type="radio" name="opciones" name="departamento" />
  13.     <br />
  14.     <label for="_opcion3">Opci&oacute;n 3:</label>
  15.     <input id="_opcion3" type="radio" name="opciones" name="opcion3" />
  16.     <br />
  17. </div>
  18. <select id="_departamento_select" class="oculto">
  19.     <option value="1">Departamento 1</option>
  20.     <option value="2">Departamento 2</option>
  21.     <option value="3">Departamento 3</option>
  22.     <option value="n">Departamento n</option>
  23. <script language="javascript" type="text/javascript">
  24.     var contenedor = document.getElementById("contenedor_radios") ;
  25.     var radios = contenedor.getElementsByTagName("input");
  26.     for(var i = 0 ; i < radios.length ; i++){
  27.         radios[i].onclick = function(){
  28.             if(this.id == "_departamento_radio"){
  29.                 document.getElementById("_departamento_select").setAttribute("class", "visible");
  30.             }
  31.             else{
  32.                 document.getElementById("_departamento_select").setAttribute("class", "oculto");
  33.             }
  34.         }
  35.     }

Esto es funcional, espero te sirva.
Saludos!
__________________
Páginas web de alta calidad y hechas a la medida.