js 全选、反选、批删
来源:互联网 发布:数据集成市场怎么样 编辑:程序博客网 时间:2024/05/21 22:29
$(function(){
//全选反选
$("#checkAll").click(function(){
var ids=document.getElementsByName("id[]")
// alert($(ids).attr("checked"));
$(ids).each(function(){
if($(this).attr("checked")!="checked"){
$(this).attr("checked",true)
}else{
$(this).attr("checked",false)
}
})
})
//全不选
$("#checkNoAll").click(function(){
var ids=document.getElementsByName("id[]")
// alert($(ids).attr("checked"));
$(ids).each(function(){
$(this).attr("checked",false)
})
})
//批量删除
$("#delAll").click(function(){
//获取批量删除值
var ids=$("input:checked");
var idss="";
$(ids).each(function(){
idss+=$(this).val()+',';
});
// alert(idss)
$.get("{url:/test/del}",{"ids":idss},function(msg){
if(msg){
$(ids).each(function(){
$(this).parents("tr").remove()
});
alert("删除成功!")
}else{
alert("删除失败!")
}
})
})
//几点技改
$(document).on("click",".price",function(){
var id=$(this).parent().attr("id");
var val=$(this).html();
// $(this).hide();
$(this).parent().html("<input size='5' class='upda' value='"+val+"'>")
$(".upda").blur(function(){
var va=$(this).val();
var _this=$(this);
$.get("{url:test/upda}",{"id":id,"price":va},function(msg){
if(msg){
_this.parent().html("<span class='price'>"+va+"</span>")
// console.log(t.html())
_this.remove();
alert("修改成功!")
}else{
alert("修改失败!")
}
})
})
})
})
//全选反选
$("#checkAll").click(function(){
var ids=document.getElementsByName("id[]")
// alert($(ids).attr("checked"));
$(ids).each(function(){
if($(this).attr("checked")!="checked"){
$(this).attr("checked",true)
}else{
$(this).attr("checked",false)
}
})
})
//全不选
$("#checkNoAll").click(function(){
var ids=document.getElementsByName("id[]")
// alert($(ids).attr("checked"));
$(ids).each(function(){
$(this).attr("checked",false)
})
})
//批量删除
$("#delAll").click(function(){
//获取批量删除值
var ids=$("input:checked");
var idss="";
$(ids).each(function(){
idss+=$(this).val()+',';
});
// alert(idss)
$.get("{url:/test/del}",{"ids":idss},function(msg){
if(msg){
$(ids).each(function(){
$(this).parents("tr").remove()
});
alert("删除成功!")
}else{
alert("删除失败!")
}
})
})
//几点技改
$(document).on("click",".price",function(){
var id=$(this).parent().attr("id");
var val=$(this).html();
// $(this).hide();
$(this).parent().html("<input size='5' class='upda' value='"+val+"'>")
$(".upda").blur(function(){
var va=$(this).val();
var _this=$(this);
$.get("{url:test/upda}",{"id":id,"price":va},function(msg){
if(msg){
_this.parent().html("<span class='price'>"+va+"</span>")
// console.log(t.html())
_this.remove();
alert("修改成功!")
}else{
alert("修改失败!")
}
})
})
})
})
0 0
- js 全选、反选、批删
- js 全选、反选、批删
- JS全选,反选
- js 全选 ,反选
- js 全选反选
- JS全选反选
- js全选反选
- js 全选,反选
- js全选,不全选,反选
- js 全选,取消全选,反选
- 全选反选代码JS
- js全选与反选
- js全选,反选,取消
- JS全选,反选,取消
- js checkout 全选 反选
- js实现全选反选
- js全选和反选
- js全选和反选
- 掌握 Linux PC 性能之基准测试
- 圆形图片
- 【一步步学OpenGL 18】 -《漫射光》
- 第八周:C:输出数字
- 【实现&调用】实现可被简单调用的python函数
- js 全选、反选、批删
- 安利一款智联招聘搜索脚本
- Windows下使用Java Jni调用C/C++初探
- PHP反射
- 2016 idea注册码
- DBCP、C3P0、Proxool、BoneCP几种数据源参数介绍
- 详解Copyleft到底是什么?
- rap接口管理工具系统的搭建
- git 使用笔记