---
title: "[JQuery]table"
author: "yepp"
date: "2006-11-21T09:47:43Z"
tags: []
slug: "jquery-table"
draft: false
lastmod: "2006-11-21T09:47:43Z"
id: 35300
url: "https://yepp.iteye.com/blog/35300"
---

js 代码

1. &lt;script type="text/javascript"&gt;
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. &lt;/script&gt;

 

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