Automatic Zebra Tables

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):

  1. Use hex values, not words, for CSS colors.
  2. Localized Date Parsing in JavaScript
  3. The Safety Palette Color Picker
  4. moreCrayons
  5. More XMLHTTPRequest

More like this: , .

blog comments powered by Disqus