User:Eleazaros/monobook.js

/* Alternating row colors for tables */ function alternateRows { rw = document.getElementsByTagName("table"); for (i = 0; i < rw.length; i++) { if (rw[i].className.match("altRows")) { rows = rw[i].getElementsByTagName("tr"); for (j = 1; j < rows.length; j++) { rw2 = rows[j].getElementsByTagName("td"); for (k=0; k < rw2.length; k++) { rw2[k].className = (j % 2 == 0 ? "even" : "odd"); }           }        }    } }  addOnloadHook( function {        alternateRows; });