Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/05/2010, 16:34
Avatar de Adler
Adler
Colaborador
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4.671
Antigüedad: 17 años, 4 meses
Puntos: 126
Respuesta: Activar checkboxes con un radio?

Hola

Prueba con esto

Código Javascript:
Ver original
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function funcion (chbox) {
  5.          for (var i=0;i < document.forms["f1"].elements.length;i++)
  6.          {
  7.          elemento = document.forms[0].elements[i];
  8.     if (elemento.type == "checkbox")
  9.     {
  10.     elemento.disabled = (document.forms["f1"].elements == chbox) ? chbox.checked : false;
  11.     }
  12.         }
  13. }
  14. </script>
  15. </head>
  16. <body>
  17. <form name="f1">
  18. <input type="radio" onclick="funcion(this)" name="bloquear">Activar
  19. <input type="checkbox" name="c1" value="" disabled /><br />
  20. <input type="checkbox" name="c2" value="" disabled /><br />
  21. <input type="checkbox" name="c3" value="" disabled /><br />
  22. <input type="checkbox" name="c4" value="" disabled />
  23. </form>
  24. </body>
  25. </html>

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;" />