Copy codeThe Code is as follows:
<Style type = "text/css">
/* Highlight */
. Highlight {
Background-color: gray
}
</Style>
Copy codeThe Code is as follows:
<Body>
<H3> provincial and municipal administrative divisions <Table border = "1" width = "50%">
<Thead>
<Tr>
<Th> Beijing </th>
<Th> Shanghai </th>
<Th> Shangqiu </th>
</Tr>
</Thead>
<Tbody>
<Tr>
<Td> Haidian </td>
<Td> Xuhui </td>
<Td> Fuyang </td>
</Tr>
<Tr>
<Td> Chaoyang </td>
<Td> Zhabei </td>
<Td> liangyuan </td>
</Tr>
<Tr>
<Td> Changping </td>
<Td> Whampoa </td>
<Td> Greentown </td>
</Tr>
</Tbody>
</Table>
</Body>
I.: first
Copy codeThe Code is as follows:
$ ("Tr: first"). addClass ("highlight"); // obtain the first matching tr element.
Ii.: last ()
Copy codeThe Code is as follows:
$ ("Tr: last"). addClass ("highlight"); // obtain the last matching tr element.
3. not (selector)
Copy codeThe Code is as follows:
$ ("Td: not (: even)"). addClass ("highlight"); // get the td except that the index is an even number.
Iv. even
Copy codeThe Code is as follows:
$ ("Tr: even"). addClass ("highlight"); // matches all elements whose index values are even and starts counting from 0.
V. odd
Copy codeThe Code is as follows:
$ ("Tr: odd"). addClass ("highlight"); // matches all elements with odd index values and starts counting from 0.
Vi. eq (index)
Copy codeThe Code is as follows:
$ ("Tr: eq (2)"). addClass ("highlight"); // matches the element of a given index value
VII.: gt (index)
Copy codeThe Code is as follows:
$ ("Tr: gt (1)"). addClass ("highlight"); // match all elements greater than the given index value
8.: lt (index)
Copy codeThe Code is as follows:
$ ("Tr: lt (2)"). addClass ("highlight"); // match all elements smaller than the given index value
9. header
Copy codeThe Code is as follows:
$ (": Header"). addClass ("highlight"); // matches title elements such as h1, h2, and h3.