tengo la siguiente función Javascript:
Código:
Básicamente Selecciona el input checkbox si no lo está y cambia el color de la fila, o deSelecciona el input checkbox si lo esta y vuelve al color original.function checked(){
document.getElementById('checkUno').checked=true;
document.getElementById('row').style.backgroundColor="#d2d2d2";
}
function unchecked(){
document.getElementById('checkUno').checked=false;
document.getElementById('row').style.backgroundColor="#ffffff";
}
function CambiaColor(){
if (document.getElementById('checkUno').checked==true){
unchecked();
}
else{
checked();
}
}
el script afecta a la siguiente tabla:
Código PHP:
<body>
<form id="formularioTest" action="#" method="post">
<table border="1">
<tr onClick="CambiaColor()" id="row"><td><input type="checkbox" name="value_0" id="checkUno"></input></td><td><p>Texto aleatorio</p></td></tr>
<tr onClick="CambiaColor()" id="row"><td><input type="checkbox" name="value_1" id="checkUno"></input></td><td><p>Texto aleatorio</p></td></tr>
<tr onClick="CambiaColor()" id="row"><td><input type="checkbox" name="value_2" id="checkUno"></input></td><td><p>Texto aleatorio</p></td></tr>
<tr onClick="CambiaColor()" id="row"><td><input type="checkbox" name="value_3" id="checkUno"></input></td><td><p>Texto aleatorio</p></td></tr>
<tr onClick="CambiaColor()" id="row"><td><input type="checkbox" name="value_4" id="checkUno"></input></td><td><p>Texto aleatorio</p></td></tr>
</table>
</form>
</body>
Alguien me puede ayudar y explicarme como hacer que la funcion se ejecute en el checkbox donde se dá el click.
espero puedan ayudarme.
Saludos


