// Js implements full selection of Reverse source code, which is super simple
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> select all </title>
<Style type = "text/css">
Table {
Border: # 0FF 1px solid;
Border-collapse: collapse;
}
Table th {
Text-align: center;
}
Table td {
Border: 1px solid #999;
Text-align: center;
}
. One {
Background: # 9FC;
}
. Two {
Background: # FC6;
}
</Style>
<Script type = "text/javascript" language = "javascript">
Function gehang (){
// Obtain the tr Node
Var tr = document. getElementsByTagName ("tr ");
// Add background color for the first line
Tr [0]. style. background = "#00FF66 ";
// Add the background color for the last line
Tr [tr. length-1]. style. background = "#00FF66 ";
}
// Create a fully-selected Inverse Function
Function xuan (type ){
// Obtain the name value
Var qcheck = document. getElementsByName ("check []");
// Obtain the selected button
If (type = "qx "){
For (var I = 0; I <= qcheck. length; I ++ ){
Qcheck [I]. checked = true;
}
}
If (type = "fx "){
For (var I = 0; I <= qcheck. length; I ++ ){
Qcheck [I]. checked = false;
}
}
If (type = "qxx "){
For (var I = 0; I <= qcheck. length; I ++ ){
If (qcheck [I]. checked ){
Qcheck [I]. checked = false;
}
Else {
Qcheck [I]. checked = true;
}
}
}
}
Function del (){
Var input = document. getElementsByName ("check []");
For (var I = input. length-1; I> = 0; I --){
If (input [I]. checked = true ){
// Get the td Node
Var td = input [I]. parentNode;
// Obtain the tr Node
Var tr = td. parentNode;
// Obtain the table
Var table = tr. parentNode;
// Remove a subnode
Table. removeChild (tr );
}
}
}
</Script>
</Head>
<Body onload = "gehang ()">
<Table width = "400" border = "0" align = "center">
<Tr>
<Th> <input type = "checkbox"> select all </th>
<Th> sender </th>
<Th> email name </th>
<Th> email attachment information </th>
</Tr>
<Tr class = "one">
<Td> <input type = "checkbox" name = "check []"> </td>
<Td> Zhang San 11 </td>
<Td> I am email 11 </td>
<Td> I am a subsidiary information 11 </td>
</Tr>
<Tr class = "two">
<Td> <input type = "checkbox" name = "check []"> </td>
<Td> Michael Jacob 12 </td>
<Td> I am an email 12 </td>
<Td> I am a subsidiary information 12 </td>
</Tr>
<Tr class = "one">
<Td> <input type = "checkbox" name = "check []"/> </td>
<Td> James 13 </td>
<Td> I am an email 13 </td>
<Td> I am a subsidiary information 13 </td>
</Tr>
<Tr class = "two">
<Td> <input type = "checkbox" name = "check []"> </td>
<Td> James 14 </td>
<Td> I am an email 14 </td>
<Td> I am a subsidiary information 14 </td>
</Tr>
<Tr class = "one">
<Td> <input type = "checkbox" name = "check []"> </td>
<Td> Zhang San 15 </td>
<Td> I am an email 15 </td>
<Td> I am a subsidiary information 15 </td>
</Tr>
<Tr class = "two">
<Td> <input type = "checkbox" name = "check []"> </td>
<Td> Michael Jacob 16 </td>
<Td> I am an email 16 </td>
<Td> I am a subsidiary information 16 </td>
</Tr>
<Tr class = "one">
<Td> <input type = "checkbox" name = "check []"> </td>
<Td> Zhang San 17 </td>
<Td> I am email 17 </td>
<Td> I am a subsidiary information 17 </td>
</Tr>
<Tr class = "two">
<Td> <input type = "checkbox" name = "check []"> </td>
<Td> Zhang San 18 </td>
<Td> I am email 18 </td>
<Td> I am affiliated information 18 </td>
</Tr>
<Tr>
<Td> <input type = "checkbox" name = "check []"> </td>
<Td> JOHN 19 </td>
<Td> I am email 19 </td>
<Td> I am affiliated information 19 </td>
</Tr>
<Tr>
<Th> <input type = "checkbox"> select all </th>
<Td colspan = "3" align = "center">
<Input type = "button" id = "qx" onclick = "xuan ('qx')" value = "select all">
<Input type = "button" id = "qxx" onclick = "xuan ('qxx')" value = "cancel all">
<Input type = "button" id = "fx" onclick = "xuan ('fx ')" value = "reselect">
<Input type = "button" id = "del" onclick = "del ()" value = "delete selected attachment">
</Td>
</Tr>
</Table>
</Body>
</Html>
From xweina's column