Ver Mensaje Individual
  #4 (permalink)  
Antiguo 01/12/2007, 10:48
Avatar de JavierB
JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 23 años
Puntos: 772
Re: Activar un checkbox al escribir en input text?

Hola de nuevo.

Creo que esto te servirá:

Código PHP:
<html>
<
head>
<
script type="text/javascript">
function 
marcar(obj) {
  
chk obj.parentNode.parentNode;
  
chk chk.getElementsByTagName('input')[1];
  
chk.checked = (obj.value.length 0);
}
</script>
</head>
<body>
<table>
<tr>
<td>negro</td>
<td><input type="text" onkeyup="marcar(this)" /></td>
<td><input type="checkbox" /></td>
<tr>
<tr>
<td>azul</td>
<td><input type="text" onkeyup="marcar(this)" /></td>
<td><input type="checkbox" /></td>
<tr>
</table>
</body>
</html> 
Saludos,