checkbox的多选与反选 jQuery 实现

简介:这是checkbox的多选与反选 jQuery 实现的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=332639' scrolling='no'> <?php
if($_POST){
print_r($_POST['id']);
}
?>
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript">
$(function() {
   /** 
    *   自定义函数id
* function id(id){
* return $("#"+id);
* }
*/
var all = id("all");
var not = id("not");
var td = $(".checkbox_id");
var ischeck;
all.click(function () {
not.attr("checked",false)
if(all.attr("checked")==true){
ischeck = true;
}else{
ischeck = false;
}
$.each(td,function(){
$(this).attr("checked",ischeck);
});
});
not.click(function() {
all.attr("checked",false)
$.each(td,function(){
if($(this).attr("checked") == true){
$(this).attr("checked",false);
}else{
$(this).attr("checked",true);
}
});
});
});
</script>
<style type="text/css">
td {
text-align:center;
}
.left{
text-align:left;
}
</style>
<form method="post" action="">
<table style="margin-left:200px;">
<tr>
<th style="60px;" class="left"></th>
    <th style="30px;">ID</th>
<th style="90px;">checkbox</th>
</tr>
<tr>
<td class="left"><input class="checkbox_id" type="checkbox" name="id[]" value="1" /></td>
<td>b</td>
<td>b</td>
</tr>
<tr>
<td class="left"><input class="checkbox_id" type="checkbox" name="id[]" value="2" /></td>
<td>c</td>
<td>c</td>
</tr>
<tr>
<td class="left"><input class="checkbox_id" type="checkbox" name="id[]" value="3" /></td>
<td>d</td>
<td>d</td>
</tr>
<tr >
<td class="left">
<input type="checkbox" id="all">全选</input><br>
<input type="checkbox" id="not">反选</input>
</td>
<td><input type="submit" value="提交"></td>
</tr>
</table>
</form>

“checkbox的多选与反选 jQuery 实现”的更多相关文章 》

爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

http://biancheng.dnbcw.info/php/332639.html pageNo:11
原文地址:https://www.cnblogs.com/ooooo/p/2249324.html