//鼠标移动表格效果 $(document).ready(function(){ $("tr[overstyle='on']").hover( function () { $(this).addClass("bg_hover"); }, function () { $(this).removeClass("bg_hover"); } ); }); function checkon(o){ if( o.checked == true ){ $(o).parents('tr').addClass('bg_on') ; }else{ $(o).parents('tr').removeClass('bg_on') ; } } function checkAll(o){ if( o.checked == true ){ $('input[name="checkbox"]').attr('checked','true'); $('tr[overstyle="on"]').addClass("bg_on"); }else{ $('input[name="checkbox"]').removeAttr('checked'); $('tr[overstyle="on"]').removeClass("bg_on"); } } //获取已选择用户的ID数组 function getChecked() { var ids = new Array(); $.each($('table input:checked'), function(i, n){ ids.push( $(n).val() ); }); return ids; }
function deleteRight(ids) { var length = 0; if(ids) { length = 1; }else { ids = getChecked(); length = ids[0] == 0 ? ids.length - 1 : ids.length; ids = ids.toString(); } if(ids=='') { ui.error('请先选择一条记录'); return ; } if(confirm('您将删除'+length+'条记录,删除后无法恢复,确定继续?')) { $.post("{:U('Operator/doDeleteRight')}",{ids:ids},function(res){ if(res=='1') { ui.success('删除成功'); removeItem(ids); }else { ui.error('删除失败'); } }); } }
function removeItem(ids) { ids = ids.split(','); for(i = 0; i < ids.length; i++) { $('#'+ids[i]).remove(); } }
<a href="javascript:void(0);" οnclick="deleteRight('{$vo.rightID}')">删除</a>
js 删除确认
最新推荐文章于 2022-02-19 22:44:31 发布