欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

[JQuery]table

程序员文章站 2022-07-16 14:05:15
...
js 代码
  1. <script type="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. </script>  

 

  • $('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