As you are iterating through the table, count rows. If the row number is odd, make it blue. If not, make it grey.

Hmm.. can it be so simple? To me, when I see the "toplist"-code I feel it could be alot harder (??).

Whoops! I'm sorry I misread your problem. But the solution (to what I think you want to do) isn't too far off.

As you are reading through the list of Top 10, divide the rating by 2. If the result comes out as an integer, the rating was EVEN. (0, 2, 4, 6, 8 or 10). If the result has a fractional part the rating will be ODD (1, 3, 5, 7, 9 - these numbers are not equally divisible by 2).

As you get this even/odd information, set it to a variable--say a boolean variable. If the variable is true, then color the table one way (say blue for even) and if it is false, then color the table the other way (say grey for odd).

Hmm..

How can I do that - I'm not the best programmer..

??

Integer division:

a = Math.floor(b/2);

Test for odd:

a = Math.floor(b/2);
if(b - a*2 > .0001){
  // code if b is odd

}
else{
  // code if b is even

};
This article has been dead for over six months. Start a new discussion instead.