Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<style type= "Text/css" >
#newsTable {margin:100px Auto;}
</style>
<script language= "javascript" type= "Text/javascript" src= "Jquery1.1.2.js" ></script><!- Upload to the network and use this to connect-->
<script language= "javascript" type= "Text/javascript" >
Ahanan Practice 2009-4-13
$ (document). Ready (function () {
$ ("#btnOk"). Click (function () {
This.value = This.value = = "All selected"? Anti-election ": Select All";
$ ("input[@type = ' checkbox ']"). CHECKCBX ();
});
});
When your code appears with each, you should rewrite the above code to construct a plugin, a word in the jquery tutorial
$.FN.CHECKCBX = function () {
Return This.each (function () {
this.checked =!this.checked;
});
}
</script>
<title> Untitled Document </title>
<body>
<table border= "1" id= "newstable" >
<tr>
<th> selection </th>
<th>Id</th>
<th> author </th>
</tr>
<tr>
<td><input type= "checkbox" Name= "CBX"/></td>
<td>1</td>
<td> Ahanan </td>
</tr>
<tr>
<td><input type= "checkbox" Name= "CBX"/></td>
<td>2</td>
<td> Ahanan </td>
</tr>
<tr>
<td><input type= "checkbox" Name= "CBX"/></td>
<td>3</td>
<td> Ahanan </td>
</tr>
<tr>
<td><input type= "checkbox" Name= "CBX"/></td>
<td>4</td>
<td> Ahanan </td>
</tr>
<tr>
<td><input type= "checkbox" Name= "CBX"/></td>
<td>5</td>
<td> Ahanan </td>
</tr>
<tr>
<td><input type= "checkbox" Name= "CBX"/></td>
<td>6</td>
<td> Ahanan </td>
</tr>
<tr>
<TD colspan= "3" ><input type= "button" Name= "Btnok" id= "Btnok" value= "Select All"/></td>
</tr>
</table>
</body>