Table odd and even rows set different color core JS code

Source: Internet
Author: User
Tags min

The form of odd and even rows to set different colors, in some cases is more practical, there is a good example, we can refer to, I hope to help you

This is a more practical function, set the color of the odd and even rows after the experience of reading table data is significantly better, otherwise the data will appear very complex and crowded (when the table data row experience is particularly obvious). Only when you really do this thing contact to have a strong experience, anyway, I have just experienced, stay here for reference to the core JS script code as follows (table element ID according to their own situation adjustment, Jquery-1.7.min.js in the code can be downloaded to jquery's official web) code as follows: <script src= "Jquery-1.7.min.js" ></script> <script> $ (    Document). Ready (function () {settablerowcolor ();  });  Use CSS to control the color function of odd and even rows Settablerowcolor () {$ ("#Table tr:odd"). CSS ("Background-color", "#e6e6fa");  $ ("#Table Tr:even"). CSS ("Background-color", "#fff0fa"); } </scirpt>

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.