Ver Mensaje Individual
  #2 (permalink)  
Antiguo 05/12/2012, 05:11
Avatar de YYs86
YYs86
 
Fecha de Ingreso: abril-2012
Ubicación: Salamanca
Mensajes: 136
Antigüedad: 12 años
Puntos: 14
Respuesta: pintar tr de tablas con jquery

Seguramente se pueda optimizar muchísimo... pero funciona:

Código Javascript:
Ver original
  1. $(document).ready(function(){
  2.  
  3.     var colours = new Array();
  4.     colours[0] = "#AAA";
  5.     colours[1] = "#CCC";
  6.     colours[2] = "#EEE";
  7.    
  8.     var i=0;
  9.     var count=0;
  10.    
  11.     $('table tbody').each(function(t){ 
  12.        
  13.         $(this).children('tr').each(function(r){
  14.        
  15.             $(this).css('background', colours[i]);
  16.        
  17.             count++;
  18.            
  19.             if(count==3){
  20.            
  21.                 i++;
  22.                 count=0;
  23.            
  24.             }
  25.            
  26.             if(i==3){
  27.            
  28.                 i=0;
  29.            
  30.             }
  31.        
  32.         });
  33.    
  34.     });
  35.  
  36. });
__________________
Web developer:

http://xtremgaming.es
http://leaderleague.com