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>