1 <styletype= "Text/css">2 Table{3 width:800px;4 text-align: Left;5 Border-collapse:collapse;6 }7 8 td, Th{9 padding:10px;Ten Border:1px solid Black; One } A </style> - <Scripttype= "Text/javascript"> - the - //Inverse Selection - functionChoose (tag) { - varInputs=document.getElementsByTagName ("input"); + //Select All - for (varI= 0; I<Inputs.length- 3; I++) { + varInputnode=Inputs[i]; A if(Tag=== 1) { at if (!inputs[i].checked) { - inputs[i].checked= true; - } - //all do not choose - } Else if(Tag=== -1) { - if(inputnode.checked) { in inputnode.checked= false; - } to } Else { + //Inverse Selection - inputs[i].checked= !inputs[i].checked; the } * } $ }Panax Notoginseng </Script> - </Head> the <Body> + <Tablecellpadding= "2"ID= "TableId"> A <TR> the <th> + Select - </th> $ <th> $ name - </th> - <th> the Age - </th>Wuyi </TR> the <TR> - <TD> Wu <label> - <inputtype= "checkbox"> About </label> $ </TD> - <TD> - Zhang San - </TD> A <TD> + + the </TD> - </TR> $ <TR> the <TD> the <inputtype= "checkbox"> the </TD> the <TD> - John Doe in </TD> the <TD> the - About </TD> the </TR> the <TR> the <TD> + <inputtype= "checkbox"> - </TD> the <TD>Bayi Zhang San the </TD> the <TD> - - - </TD> the </TR> the <TR> the <TDcolspan= "3"> the <inputtype= "button"onclick= "Choose (1)"value= "Select All"> - <inputtype= "button"onclick= "Choose ( -1)"value= "All is not selected"> the <inputtype= "button"onclick= "Choose (0)"value= "Reverse Selection"> the </TD> the </TR>94 </Table>
JS Multi-Select Select All