1. The JQuery selector inherits some of the CSS and path speech syntaxes and allows you to quickly and accurately select DOM elements by Tag Name, attribute name, and content. 2. Compared with JavaScript, JQuery selector has the advantage of simple code and perfect detection mechanism. 3. Use the JQuery selector to change the color of the line. The sample code is as follows: <! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN"> <HTML> <HEAD> <TITLE> Use JQuery to implement line-breaking color </TITLE> <META NAME = "Generator" CONTENT = "EditPlus"> <meta name = "Author" CONTENT = ""> <meta name = "Keywords" CONTENT = ""> <meta name = "Description "CONTENT =" "> <style type =" text/css "> body {font-size: 12px; text-align: center} # tbStu {width: 260px; border: solid 1px #666; background-color: # eee} # tbStu tr {line-height: 23 Px} # tbStu tr th {background-color: # ccc; color: # fff} # tbStu. trOdd {background-color: # fff} </style> <script language = "javascript" type = "text/javascript" src = "jquery-1.8.3.min.js"> </script> <script type = "text/javascript"> $ (function () {$ ("# tbStu tr: nth-child (even )"). addClass ("trOdd ");}) </script> </HEAD> <BODY> <table id = "tbStu" cellpadding = "0" cellspacing = "0"> <tbody> <tr> <th> Student id </th> <th> name </th> <th> Other </th> <th> total score </th> </tr> <td> 1001 </td> <td> Zhang Xiaoming </td> <td> male </td> <td> 320 </td> </tr> <td> 1002 </td> <td> Li Ming flag </td> <td> female </td> <td> 350 </td> </tr> </tbody> </table> </BODY> </HTML> for example: 4. The following code uses JavaScript to implement line-changing: <script type = "text/javascript"> window. onload = function () {var oTb = document. getElementById ("tbStu"); for (var I = 0; I <oTb. rows. length-1; I ++) {if (I % 2) {oTb. rows [I]. className = "trOdd" ;}}</script> JQue Ry implements the line-changing code: </script> <script type = "text/javascript" >$ (function () {$ ("# tbStu tr: nth-child (even) "). addClass ("trOdd") ;}) </script> compared to the two, it is obvious that JQuery code is simpler.