User:Chevrine/monobook.js

/* functions for alternating row colors in tables */ function setAlternateRows(tbl, parseClass) { rows = tbl.getElementsByTagName("tr"); for (k = 1; k < rows.length; k++) { rows[k].className = (k % 2 == 0 ? "even" : "odd"); }   return; } function alternateRows { tbls = document.getElementsByTagName("table"); for (i = 0; i < tbls.length; i++) { tbl = tbls[i]; parseClasses = tbl.className.split(" "); for (j = 0; j < parseClasses.length; j++) { parseClass = parseClasses[j]; switch( parseClass ) { case "bandedRows": setAlternateRows( tbl, parseClass ); break; default: break; }       }    } } addOnloadHook( function {        alternateRows });