Rather than assigning CSS class names to table cells in order to get alternating row colors, David F. Miller suggests walking the table’s DOM with a JavaScript function, and assigning the table cell’s background color on the browser.
I was doing something similar to that with a JavaScript method that assigned background colors after adding or deleting a row from an HTML table, but I didn’t think to have JavaScript handle this from the start.
Possibly Related posts (machine generated):