<script>
function chooseAll(obj){ //全选
if($(obj).prop("checked")){
$("#table").find(":checkbox").prop("checked",true);
}else{
$("#table").find(":checkbox").prop("checked",false);
}
}
function invertSelect(){ //反选
$("input[type='checkbox']").each(function(index,item){
if($(item).attr("checked")){
$(item).attr("checked",false);
}else{
$(item).attr("checked",true);
}
})
}
function allSelect(){ //全选
$("input[type='checkbox']").each(function(index,item){
$(item).attr("checked",true);
});
}
function allDelete(){ //全部删除
var ids="";
$("input[type='checkbox']").each(function(index,item){
if($(item).attr("checked")){
ids+=$(item).val()+",";
}
});
if(ids==""){
return ;
}
if(!confirm("您确定取消选择的资源与模版的关联么?")){
return ;
}
$.ajax({
type:"POST",
url:"${basePath}<c:url value='resourceRelation/allDelete.action'/>",
data:{'ids':ids},
success:function(data){
if(data=='Y'){
window.parent.openAlert("资源与模版关联已取消!");
self.location.href="${basePath}resourceRelation/already.action?mark=${mark}";
}else if(data=='N'){
window.parent.openAlert("资源与模版关联取消失败!");
self.location.href="${basePath}resourceRelation/already.action?mark=${mark}";
}
},
error:function(){
window.parent.openAlert("网络原因,取消失败!");
}
});
}
</script>
转载于:https://my.oschina.net/zhongshao/blog/195435