Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/04/2010, 22:56
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 9 meses
Puntos: 1567
Respuesta: ayuda con checkbox

Esto hace lo que tu quieres

Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>Activar campo por CheckBox</title>
  5. <script type="text/javascript">
  6. function campo_enabled( ) {
  7. document.forms['form1'].elements['texto_nombre'].disabled =! document.forms['form1'].elements['activar'].checked;
  8. }
  9. </head>
  10.  
  11. <body onload="document.forms['form1'].elements['texto_nombre'].disabled=true;">
  12. <form id="form1" action="#">
  13. <input type="checkbox" id="activar" name="activar" onchange="campo_enabled()" />
  14. <label for="activar">Activar con checkBox</label><br />
  15. <input type="text" id="texto_nombre" />
  16. </form>
  17. </body>
  18. </html>

Saludos