Gestreifte Tabelle mit Filter Funktion

eins zwei drei vier
januar abc katze abc
maerz abc lief abc
oktober abc im abc
oktober abc schnee abc
maerz abc katze abc
oktober abc lief abc
oktober abc im abc
januar abc schnee abc
maerz abc katze lief im schnee abc
oktober abc Katze lief im Schnee abc
maerz abc katze schlief im schnee abc

javascript teil

<script type="text/javascript" src=jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {

      // over function color changes
      $(".tablestripe tr").mouseover(function() {
         $(this).addClass("over");
      })
      .mouseout(function() {
         $(this).removeClass("over");
      });

      // zebra striped table
      $(".tablestripe tr:even").addClass("second");

      // input field changes
       $("#zebraFilter").bind("keyup", function() {

         filterTxt = $(this).val();
         $("#zebraFilter").attr({value: filterTxt});

         // filter 
         $(".zebra tr").hide();
         $(".zebra tr.ttshow").show();
         $(".zebra tr").filter(":contains(" + filterTxt + ")").show();

         // striped table for filter results
         $(".zebra tr").removeClass("second");
         $(".zebra tr").filter(":contains(" + filterTxt + "):even").addClass("second");

     });

});
</script>

css teil

<style type="text/css">
table {
   border-collapse: collapse;
   width: 400px;
   margin: 20px;
   font-size: .9em;
}

th {
   background: #423;
   color: #fff;
   font-weight: bold;
   padding: 5px 10px;
   text-align: left;
}

td {
   padding: 5px 10px;
   border-bottom: 1px solid #a00;
}

tr.second td {
   background: #ecd;
}

tr.over td {
   background: #cab;
}
</style>

links

Sag etwas dazu: