Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/10/2006, 16:23
Avatar de skatomundo
skatomundo
 
Fecha de Ingreso: junio-2002
Ubicación: Santiago - CL
Mensajes: 2.532
Antigüedad: 22 años, 8 meses
Puntos: 125
Colorear Filas al chequear - [checkbox]

IkaroU!

Espero te sirva para colorear tus filas al activar un checkbox correspondiente generado dinámicamente:

El ID de cada línea igual se genera dinámicamente..Ojo!

Código PHP:
<script>
isIE=document.all?true:false;
var 
isNS4=document.layers?true:false
var 
isNS6=navigator.userAgent.indexOf("Gecko")!=-1?true:false;
var 
bC=new Array('#BFCBE3','white');
var 
C=new Array('black','hotpink');

function 
colorea(_v)
{
  var 
X=eval("document.form1.op"+_v+".checked?0:1");
  if(
isIE)
  {
    eval(
"t"+_v+".style.backgroundColor=bC[X]");
    eval(
"t"+_v+".style.color=C[X]");
  }
  if(
isNS6)
  {
    
document.getElementById("t"+_v).style.backgroundColor=bC[X];
    
document.getElementById("t"+_v).style.color=C[X];
  }
}
</script> 
================================================== =====
Código HTML:
//NAME: "form1"
<form name="form1" action="" method="post">
<table>
<?php for($x=0;$x<10;$x++){?>
<tr id=t<?php echo $x; ?>>
	<td>Colorear Fila</td>
	<td align="center" class=ts><input name="op<?php echo $x; ?>" type="checkbox" value="1" onclick='colorea(<?php echo $x; ?>)'></td>
</tr>
<?php } ?>
</table>
</form>