Blogger Information
Blog 91
fans 2
comment 4
visits 127825
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
复选框全选取消
夏日的烈风的博客
Original
718 people have browsed it

https://blog.csdn.net/u013871100/article/details/52740061

<script>

    $('#dosubmit').click(function(){

        var checkID = [];//定义一个空数组


        $("input[name='check']:checked").each(function(i){//把所有被选中的复选框的值存入数组

            checkID[i] =$(this).val();

        });


        //用Ajax传递参数

        $.post('Ajax.php',{checkID:checkID},function(json){


        },'json')

    })

</script>




function selectAll() {

if ($("#select-all").is(":checked")) {

$("[name='selected']").prop("checked", true);
} else {

$("[name='selected']").prop("checked", false);
}

//选中传递参数id

  var str = "";
  var i=0;
  $("input[name='checkbox']:checkbox").each(function () {
     if ($(this).is(':checked')) {
        str+=$(this).val()+",";
        i++;
     }
  });



//批量删除

$('.batchDelete').live('click',function(){

var ids=[];


//获取被选中的checkbox,然后将其id塞进ids中

$("input[name='items']:checked").each(function(){

ids.push($(this).attr('data-option'));

          });


//采用逗号隔开塞进ids的每个id

var delIds=ids.join(",");

//console.log(ids+" -- "+ids.length);

if(delIds.length==0){

alert('请选择需要删除的数据');

return false;

}


if(confirm('是否批量删除选中的数据?')){

var url=this.href;

console.log(delIds);

$.post(url,{delIds:delIds},function(requestData){

alert(requestData);

window.location.reload(true);

});

}


return false;

});


});















Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post