You are viewing the MafiaScum.net Wiki. To play the game, visit the forum.

User:Yessiree/monobook.js: Difference between revisions

From MafiaWiki
Jump to navigation Jump to search
(Added logic to dynamically add class names to table rows in order to pick up css)
(Blanked the page)
 
Line 1: Line 1:
/* dynamically add class names to table rows to apply css properties */


window.onload = init;
function init() {
var table = document.getElementById('on-going');
var container = table.getElementsByTagName('tbody');
var list = container[0].children;
var count = list.length;
if ( count > 2 ) {
for ( i = 1; i < count; i++ ) {
if ( i % 2 == 0 ) {
list[i].className += "even";
} else {
list[i].className += "odd";
}
}
}
var table2 = document.getElementById('finished');
var container2 = table2.getElementsByTagName('tbody');
var list2 = container2[0].children;
var count2 = list2.length;
if ( count2 > 2 ) {
for ( j = 1; j < count2; j++ ) {
if ( j % 2 == 0 ) {
list2[j].className += "even";
} else {
list2[j].className += "odd";
}
}
}
var table3 = document.getElementById('completed');
var container3 = table3.getElementsByTagName('tbody');
var list3 = container3[0].children;
var count3 = list3.length;
for ( k = 1; k < count3; k++ ) {
if ( k % 2 == 0 ) {
list3[k].className += "even";
} else {
list3[k].className += "odd";
}
}
}

Latest revision as of 20:56, 16 February 2014