zoukankan      html  css  js  c++  java
  • 批删,全选

    <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);
    }
    }
  • 相关阅读:
    Gym
    [APIO2014] 回文串
    python选课系统
    python面向对象之类成员修饰符
    python面向对象之类成员
    python的shelve模块
    python的re模块
    python的configparser模块
    python的sys和os模块
    python的hashlib模块
  • 原文地址:https://www.cnblogs.com/taikongliu/p/6358438.html
Copyright © 2011-2022 走看看