[Css]
Copy codeThe Code is as follows:
<Style>
. Height {
Background: #666666;/* the background color is gray */
}
Tr {
Cursor: pointer;/* hand shape */
}
</Style>
<Style>
. Height {
Background: #666666;/* the background color is gray */
}
Tr {
Cursor: pointer;/* hand shape */
}
</Style>
[Html]
Copy codeThe Code is as follows:
<Body>
<Table border = "1" width = "40%">
<Tr> <th> </th> <th align = "left"> name </th> <th align = "left"> gender </th> <th align = "left"> Place of Residence </th> </tr>
<Tr>
<Td> <input type = "radio" name = "radio"/> </td> <td> Zhang San </td> <td> male </td> <td> beijing </td>
</Tr>
<Tr>
<Td> <input type = "radio" name = "radio"/> </td> <td> Li Si </td> <td> male </td> <td> shanghai </td>
</Tr>
<Tr>
<Td> <input type = "radio" name = "radio"/> </td> <td> Wang Wu </td> <td> female </td> <td> shenzhen </td>
</Tr>
<Tr>
<Td> <input type = "radio" name = "radio"/> </td> <td> Zhao liu</td> <td> female </td> <td> Beijing </td>
</Tr>
<Tr>
<Td> <input type = "radio" name = "radio"/> </td> <td> Sun Qi </td> <td> male </td> <td> Shanghai </td>
</Tr>
</Table>
</Body>
<Body>
<Table border = "1" width = "40%">
<Tr> <th> </th> <th align = "left"> name </th> <th align = "left"> gender </th> <th align = "left"> Place of Residence </th> </tr>
<Tr>
<Td> <input type = "radio" name = "radio"/> </td> <td> Zhang San </td> <td> male </td> <td> beijing </td>
</Tr>
<Tr>
<Td> <input type = "radio" name = "radio"/> </td> <td> Li Si </td> <td> male </td> <td> shanghai </td>
</Tr>
<Tr>
<Td> <input type = "radio" name = "radio"/> </td> <td> Wang Wu </td> <td> female </td> <td> shenzhen </td>
</Tr>
<Tr>
<Td> <input type = "radio" name = "radio"/> </td> <td> Zhao liu</td> <td> female </td> <td> Beijing </td>
</Tr>
<Tr>
<Td> <input type = "radio" name = "radio"/> </td> <td> Sun Qi </td> <td> male </td> <td> Shanghai </td>
</Tr>
</Table>
</Body>
Jquery
[Javascript]
Copy codeThe Code is as follows:
Plaincopyprint? $ (Document). ready (function (){
// The first method: $ ("tr: gt (0)") the title of the first line does not work.
$ ("Tr: gt (0)"). click (function (){
$ (This ). addClass ("height "). siblings (). removeClass ("height "). end (). find (": radio "). attr ("checked", true );
})
// Method 2: $ ("tr: not (: first )")
/* $ ("Tr: not (: first)"). click (function (){
$ (This ). addClass ("height "). siblings (). removeClass ("height "). end (). find (": radio "). attr ("checked", true );
})*/
})
$ (Document). ready (function (){
// The first method: $ ("tr: gt (0)") the title of the first line does not work.
$ ("Tr: gt (0)"). click (function (){
$ (This ). addClass ("height "). siblings (). removeClass ("height "). end (). find (": radio "). attr ("checked", true );
})
// Method 2: $ ("tr: not (: first )")
/* $ ("Tr: not (: first)"). click (function (){
$ (This ). addClass ("height "). siblings (). removeClass ("height "). end (). find (": radio "). attr ("checked", true );
})*/
})