
代码如下:
全选/全部不选
1
2
3
4
$("#chekcAll").click(function(){
if(this.checked){
$("input[name=items]").attr("checked","checked");
}
else{
$("input[name=items]").attr("checked",null);
}
})
function show(){
var strIds=new Array();//声明一个存放id的数组
$("input[name=items]").each(function (i,d){
if (d.checked) {
strIds.push(d.value);
}
})
if(strIds.length<1)
alert("您没有选中项!");
else{
var ids=strIds.join(",");
alert("你选中的字符串有:"+ids);
}
}
script>