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>
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.