jquery 全选反选 #jquery
//全选框
<input name="h_tab_checkbox" id="p_all" type="checkbox">
<input name="batch" value="<?=$value['contract_id']?>" type="checkbox">
<script type="text/javascript">
//全选
$('#p_all').click(function(){
if($(this).prop("checked")){
$('[name="batch"]').prop('checked', true);
}else{
$('[name="batch"]').prop('checked', false);
}
})
//批量操作
function bacthChage(number){
//获取contract_id
var contract_id='';
$('[name="batch"]:checked').each(function(i,n){
contract_id+= n.value+','
});
if(contract_id==''){
alert("请选择数据");return false;
}
var url ='/index.php?app_act=tms/report/batch_change_payable';
layer.confirm('确定批量更新吗?', {
btn: ['确定','取消'],
icon: 7,
offset: ['300px', '600px']
}, function(){
$.post(url,{contract_id:contract_id,batch_type:number},function(response){
layer.msg(response.msg,{icon: 6,offset: ['300px', '600px']}, function(index){
location.reload();
})
},'json');
}, function(){
layer.close();
});
}
</script>