Posted By

tcelestino on 10/02/10


Tagged

DOM html5


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

SpinZ


sortlist color


 / Published in: HTML
 

  1. <html lang="pt-BR">
  2. <meta charset="UTF-8" />
  3. <title>Zebra</title>
  4. .zebraon{background:silver}
  5. </style>
  6. window.onload=function(){
  7. var zebrar=document.querySelectorAll('.zebra tbody tr')
  8. for(var i=0;i<zebrar.length;i+=2)
  9. zebrar[i].className='zebraon'
  10. }
  11. </script>
  12. </head>
  13.  
  14. <table class="zebra">
  15. <thead><tr>
  16. <th>Vendedor</th> <th>Total</th>
  17. </tr></thead>
  18. <tbody><tr>
  19. <td>Manoel</td> <td>12.300,00</td>
  20. </tr><tr>
  21. <td>Joaquim</td> <td>21.300,00</td>
  22. </tr><tr>
  23. <td>Maria</td> <td>13.200,00</td>
  24. </tr><tr>
  25. <td>Marta</td> <td>32.100,00</td>
  26. </tr><tr>
  27. <td>Antonio</td> <td>23.100,00</td>
  28. </tr><tr>
  29. <td>Pedro</td> <td>31.200,00</td>
  30. </tr></tbody>
  31. </body>
  32. </html>

Report this snippet  

You need to login to post a comment.