20 mar 2009

Kolorowanie rekordów

<script>
  $(function () {
    $('.zebra tr:even').addClass('even');
    $('.zebra tr:odd').addClass('odd');
  });
</script>
 
<style>
  .zebra tr.even td,
  .zebra tr.even th {
    background-color: #FFF;
  }
  .zebra tr.odd td {
    background-color: #A9C0E0;
  }
</style>

<table class='zebra'>
  <thead>
    <tr>
      <th>pierwsza</th>
      <th>druga</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>2009-03-20
      <td>
      <td>1
      <td>
    </tr>
    <tr>
      <td>2009-03-20
      <td>
      <td>2
      <td>
    </tr>
    <tr>
      <td>2009-03-20
      <td>
      <td>3
      <td>
    </tr>
  <tbody>
</table>