Ver Mensaje Individual
  #3 (permalink)  
Antiguo 21/05/2010, 15:38
Avatar de wiwi74
wiwi74
 
Fecha de Ingreso: marzo-2008
Mensajes: 515
Antigüedad: 16 años, 11 meses
Puntos: 10
Respuesta: Cambiar color background a DIV con checkBox

Prueba esto:
Checa y descheca:



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>

<body>

<form>
<table border="1" cellpadding="10">
<tr id="1">
<td><input onclick="if(this.checked){
document.getElementById('1').style.backgroundColor ='red';
}else{
document.getElementById('1').style.backgroundColor ='blue';
}"
type="checkbox" /></td>
<td >Contenido</td>
<td >Contenido</td>
<td >Contenido</td>
</tr>

<tr id="2">
<td><input onclick="if(this.checked){
document.getElementById('2').style.backgroundColor ='red';
}else{
document.getElementById('2').style.backgroundColor ='blue';
}"
type="checkbox" /></td>
<td >Contenido</td>
<td >Contenido</td>
<td >Contenido</td>
</tr>

</table>
</form>


</body>
</html>