How to Use jquery to control the color of table parity rows and active rows _ jquery

Source: Internet
Author: User
This article mainly introduces how to use jquery to control the color of table parity rows and active rows. If you need jquery, you can refer to it. Although jquery has been popular for many years, it has always been difficult, I didn't take the time to study it, but sometimes I went to see it on a whim one day. After a few days, I would forget it. I recently used different colors for table parity rows, so I had to look at jquery again. Although it was still difficult, it was no longer the same as before. After that, I have to sigh that jquery is really awesome. I don't have to write a lot of javascript Functions to implement it myself. It's easy to get it done with just a few simple words.

First, define the parity row style of the table, as shown in the following code:

The Code is as follows:


Body {
Font-size: 12px;
}

Th {
Color: # FFFFFF;
Background: # A172AC;
}

Table, table td, table th {
Padding: 0.5em;
Margin: 0;
Border: 0;
Border-spacing: 0;
}
/* Odd items 1, 3, 5, 7 ,...*/
Table tbody tr. odd,
. Odd {
Background: # FBD106;
}

/* Even items 2, 4, 6, 8 ,...*/
Table tbody tr. even,
. Even {
Background: # E6453B;
}

/* Hovered items */
. Odd: hover,
. Even: hover,
. Hover {
Background: #4BB747;
Color: # FFFFFF;
}


Then there is the page code:

The Code is as follows:






Use jquery to implement different colors for table parity rows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.