Jquery universal method (2) Implement table style settings

Source: Internet
Author: User

In the previous article, jquery implemented the full selection of checkbox and got some suggestions from friends. I did not know the definition of the plug-in, and I had a joke. Some friends suggested that I go to "sharp Jquery". to be honest, I am reading it. As I am learning, I want to write the jquery effect that is frequently used in projects as a general method. With your help, I can improve these methods, it also makes it impossible to understand a practice.

Create your own Jquery collections library for future use. These examples are self-written and have no reference. Therefore, there are many improvements to be made.

1: Why write this method?

In the project, you must set styles for some tables. To make the style beautiful, the header is a style, with an odd number of rows and an even number of rows. The color changes when the mouse passes, and the color is restored when the mouse leaves.

2: Implementation Process

Js file xs_table_css.js

 xs_table_css = ;      xs_table_th_css = ;      xs_table_even_css = ;      xs_table_odd_css = ;      xs_table_select_css = ;      xs_table =  +).children().children().has().addClass(xs_table_th_css);          tr_even = $().children().children().has();          tr_odd = $().children().children().has(); 

 

Sample file xs_table.css

----

Page file xs_table_css.htm

<! DOCTYPE html PUBLIC> 

3: Method description

(1) You need to remove the previous css before mouseover and mouseout. Otherwise, style overlay will appear.

(2) Pay attention to tbody when searching for tr. Although there is no tbody tag on the page, this child element is used by default.

(3) To remove th from the odd and even lines, only find

4: The actual tableformat is set to. Zip.

Thank you for your correction. You have learned and made progress together.

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.