Turn the page to save the selected check box

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
    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+",";
                }
             }
            if(oneches[i].checked==false){
                if(contains(checkedIds,oneches[i].value)){
            checkedIds=checkedIds.replace((oneches[i].value+","),"");
                }
             }
         }
     }
    function getChecked(){
        if(checkedIds==""){
            return;
        }
        var oneches=document.getElementsByName("ids");
        for(var i=0;i<oneches.length;iPP){
            if(contains(checkedIds,oneches[i].value)){
                 oneches[i].checked="checked";
            }
         }
     }
    function contains(obj, ele) {
        if(obj==""){
            return;
        }
        var arr = obj.split(",");
        var i = arr.length;
        while (i--) {
            if (arr[i] == ele) {
                return true;  
            }  
        }  
        return false;  
    }
<a href="list?pageIndex=${pageUtil.pageIndex<pageUtil.pageCount?pageUtil.pageIndex+1:pageUtil.pageCount}" class="next" onclick="changeIds();getChecked();contains(this,obj,ele);"></a>

Sep.09,2021

Building owner, save the id saved on the current page in sessionStorage or cookie . It is possible to


changeIds this method has been called?
oneches [I]. Value log to see if it has any value?

Menu