source: trunk/packages/invirt-web/code/static/stripe.js @ 1793

Last change on this file since 1793 was 1318, checked in by price, 16 years ago

sipb-xen-www -> invirt-web

File size: 685 bytes
RevLine 
[618]1/*
2 * The general idea is from the following A List Apart article:
3 * http://www.alistapart.com/articles/zebratables/
4 *
5 * The structure is inspired by the code fragment they supply, but the
6 * code here is significantly cleaner. It also colors every two lines
7 * rather than every line, since XVM uses two rows for each item.
8 */
9
10function stripe(table, darkClass, lightClass) {
11    for (var i = 0; i < table.rows.length; i++ ) {
12        /* The header row should be light; the next two are dark. */
13        if (i%4 == 1 || i%4 == 2)
14            table.rows[i].className += ' ' + darkClass;
15        else if (lightClass)
16            table.rows[i].className += ' ' + lightClass;
17    }
18}
Note: See TracBrowser for help on using the repository browser.