首页 > 其他 > 详细

批删,全选

时间:2017-01-30 22:47:46      阅读:228      评论:0      收藏:0      [点我收藏+]
<th>全选<input type="checkbox" onclick="all_()" class="che_"></th>
<td><input type="checkbox" name="check_" value="<?php echo $v[‘w_id‘] ?>"></td>
function dels() //批删
{
var w_id = ‘‘;
$(‘input[name=check_]‘).each(function () {
if ($(this).is(‘:checked‘)) {
w_id += ‘,‘ + $(this).val();
}
});
if(w_id==‘‘){
alert(‘还没有选中呢‘);
}else{
if (confirm(‘确认删除吗?‘)) {
$.ajax({
url: ‘index.php?r=hshuo/dels‘,
data: {id: w_id.substr(1)},
// datatype:‘json‘,
type: ‘post‘,
success: function (txt) {
if (txt > 0) {
$(‘input[name=check_]‘).each(function(){
if($(this).is(‘:checked‘)){
$(this).parent().parent().remove(); //删除节点
}
});
$(‘.che_‘).prop(‘checked‘,false); //把全选变成不选中的状态

alert(‘删除成功‘);
} else {
alert(‘删除失败‘)
}
}
})
}
}
}
function all_() //全选
{
if($(‘.che_‘).is(‘:checked‘)){
$(‘input[name=check_]‘).prop(‘checked‘,true);
}else {
$(‘input[name=check_]‘).prop(‘checked‘,false);
}
}

批删,全选

原文:http://www.cnblogs.com/taikongliu/p/6358438.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!