[JQuery]table

阅读更多
js 代码
  1. "text/javascript">   
  2. $(document).ready(function(){   
  3. $(".stripeMe tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});   
  4. $(".stripeMe tr:even").addClass("alt");   
  5. });   
  6.   

 

  • $('p') = find all paragraphs
  • $('.whatever') = find everything with class="whatever"
  • $('.stripeMe tr') = find all tr (table rows) inside an element with the "stripeMe" class
  • In the code:$(".stripeMe tr").... find all rows of a table with class="stripeMe"
  • the code:$(".stripeMe tr:even")......any table with class name "stripeMe" will be striped
  • $('.whatever').mouseover() tells jQuery "Everything with class name 'whatever' will have a new onMouseover event
  • 你可能感兴趣的:(jQuery,JavaScript)