Posted By

loric on 05/02/10


Tagged

javascript table row color stripes alternate striped


Versions (?)

Stripy Table


 / Published in: JavaScript
 

  1. var tables = getElementsByClassName("dataTable");
  2.  
  3. for (var i = 0, ii = tables.length; i < ii; i++)
  4. {
  5. var tbody = tables[i].getElementsByTagName("tbody");
  6.  
  7. for(j = 0, jj = tbody.length; j < jj; j++)
  8. {
  9. var rows = tbody[j].getElementsByTagName("tr");
  10.  
  11. for(k = 1, kk = rows.length; k < kk; k += 2)
  12. {
  13. rows[k].className = "alt";
  14. }
  15. }
  16. }

Report this snippet  

You need to login to post a comment.