function batchdel() {//
var chk_value =[];
$("input[name="ids"]:checked").each(function(){ //
chk_value.push($(this).val());
});
if (chk_value.length==0) {
alert("");
return false;
}
if (chk_value.length > 0) {
var msg = "" + chk_value + "";
if (confirm(msg) == true) {
location.href = "<%=basePath%>user/batchDelete?chk_value=" + chk_value;
return true;
} else {
return false;
}
}
}
var checkedIds=""; //id
/**
*
* @return
*/
function changeIds(){
var oneches=document.getElementsByName("ids");
for(var i=0;i<oneches.length;iPP){
if(oneches[i].checked==true){
//
if(!contains(checkedIds,oneches[i].value)){
checkedIds+=oneches[i].value+",";
//console.log(oneches[i].value);
}
}
if(oneches[i].checked==false){
// idid
if(contains(checkedIds,oneches[i].value)){
checkedIds=checkedIds.replace((oneches[i].value+","),"");
}
}
}
}
/**
*
* @return
*/
function getChecked(){
if(checkedIds==""){
return;
}
var oneches=document.getElementsByName("ids");
for(var i=0;i<oneches.length;iPP){
//id
if(contains(checkedIds,oneches[i].value)){
oneches[i].checked="checked";
//console.log(oneches[i].value);
}
}
}
/**
*
* @param obj
* @param ele
* @return
*/
function contains(obj, ele) {
//console.log(obj);
//console.log(ele);
if(obj==""){
return;
}
/*obj*/
var arr = obj.split(",");
//console.log(arr);
var i = arr.length;
while (i--) {
if (arr[i] == ele) {
return true;
}
}
return false;
}
function handleClick(){
changeIds();
getChecked();
contains("1","2");
}
No error is reported. There is output in the console, but no effect is achieved