Difference between revisions of "MediaWiki:Monobook.js"
From BroaDWcast
Jump to navigationJump to searchJohn Lavalie (talk | contribs) (Created page with "→Any JavaScript here will be loaded for users using the MonoBook skin: →functions for alternating row colors in tables: function setAlternateRows(tbl, parseClass) { ...") |
(No difference)
|
Revision as of 17:04, 23 March 2012
/* Any JavaScript here will be loaded for users using the MonoBook skin */
/* 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()
});