Ver Mensaje Individual
  #4 (permalink)  
Antiguo 18/06/2009, 12:54
Andrew777
 
Fecha de Ingreso: junio-2009
Ubicación: Bolivia
Mensajes: 96
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Sobre manejo de colores con javascript

Muchas, gracias David el Grande, sos un grande. Bueno, cualquier duda te estare consultando. Y finalmente el codigo queda asi:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>

<script>

function colorear(obj)
{
fila = obj.parentNode.parentNode;
if(obj.checked)
fila.style.backgroundColor = "#FFCC99";
else
fila.style.backgroundColor = "#DDDDDD";
}


function cambiar_color_over(celda){


if (!celda.getElementsByTagName("input")[0].checked)
{ /* Cambiar color */

celda.style.backgroundColor="#ccffcc";

}

}
function cambiar_color_out(celda){

if (!celda.getElementsByTagName("input")[0].checked)
{
celda.style.backgroundColor="#dddddd";

}
}

</script>
</head>
<body>
<table>
<thead>
<tr align="center">
<th>Campo1</th>
<th>Campo2</th>
<th>Campo3.</th>
</tr>
</thead>

<tr bgcolor='#F0F0F0' onmouseover="cambiar_color_over(this)" onmouseout="cambiar_color_out(this)">

<td><input id="miCheck1" type="checkbox" name="miCheck" onclick="colorear(this)"></td>
<td> </td>
<td> </td>
<td> </td>
</tr>

<tr bgcolor='#F0F0F0' onmouseover="cambiar_color_over(this)" onmouseout="cambiar_color_out(this)">

<td><input id="miCheck2" type="checkbox" name="miCheck" onclick="colorear(this)"></td>
<td> </td>
<td> </td>
<td> </td>
</tr>

<tr bgcolor='#F0F0F0' onmouseover="cambiar_color_over(this)" onmouseout="cambiar_color_out(this)">
<td><input id="miCheck3" type="checkbox" name="miCheck" onclick="colorear(this)"></td>
<td> </td>
<td> </td>
<td> </td>
</tr>


</table>
</body>
</html>