After learning jquery, I was surprised to find its function. Adding a background color to a table can also be implemented using css, but I had to add a background color in one row in the & lt; tr & gt; tag, however, jquery only requires four lines of code, which is a simple usage. I am very interested in jquery and have to marvel at the efficiency brought by new technologies! The following is my "work", but it is simple to implement its functions, not to do other functions.
After running the script, you need to refresh it. The code above is relatively simple. For more examples, you can search for articles published by the home of scripts.
<Script language = "javascript" src =" http://img.jb51.net/jslib/jquery/jquery.js?1.1.15 "> Script <script type =" text/javascript "> <! -- $ (Document ). ready (function () {// $ (". afflik "). mouseover (function () {// window. status = this. title; return true ;//}). mouseout (function () {// window. status = 'done'; return true; //}); $ (". nnn tr "). mouseover (function () {$ (this ). addClass ("over ")}). mouseout (function () {$ (this ). removeClass ("over")}); $ (". nnn tr: even "). addClass ("alt") ;}); --> script <style type = "text/css"> <! -- Th {background: # 0099CC; height: 30px; color: # FFFFFF; line-height: 30px;} td {border-bottom: 1px solid # CC9999; height: 25px ;} tr. alt td {background: #990066; color: # FFFFFF} tr. over td {background: # 0033FF ;} --> </style> <table class = "nnn" border = "0" cellpadding = "0" cellspacing = "0"> <thead> <tr> <th> header </th> <th> header </th> </tr> </thead> <tbody> <tr> <td> Home of feet </td> <td> jb51.net </td> <td> 4561263 </td> </tr> <td> 123456 </td> <td> 789879 </td> <td> 4561263 </td> </tr> <td> 123456 </td> <td> 789879 </td> <td> 4561263 </td> </tr> <td> 123456 </td> <td> 789879 </td> <td> 4561263 </td> </tr> <td> 123456 </td> <td> 789879 </td> <td> 4561263 </td> </tr> <td> 123456 </td> <td> 789879 </td> <td> 4561263 </td> </tr> <td> 123456 </td> <td> 789879 </td> <td> 4561263 </td> </tr> <td> 123456 </td> <td> 789879 </td> <td> 4561263 </td> </tr> </ tbody> </table>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]