如何从复选框中将名称放在JavaScript getElementById函数中

So, I've got this code:

PHP

if($row['accept']==1){
    echo "<input type=\"checkbox\"  name=\"check[".$row['id']."]\" value=\"0\">Decline";
}
else{
    echo "<input type=\"checkbox\" name=\"check[".$row['id']."]\" value=\"1\">Accept";
}

JavaScript

function do_this(c){    
        var checkboxes = document.getElementsByName('check[]');
        var checkAll = document.getElementById('checkAll');

        var v=gid(c);
        if(checkAll.value == 'select'){
            for (var i in checkboxes){
                checkboxes[i].checked = '';
            v.style.display="none";
        }
            checkAll.value = 'deselect';
        }else{
            for (var i in checkboxes){
                checkboxes[i].checked = 'true';
            v.style.display="inline";
        }
            checkAll.value = 'select';
            }
}

I need to get the name from the input checkboxes, and get it with the document.getElementsByName('the name needs to be here'). But I don't know how to write the name form the checkbox in the Java function. Is there a posibility to do this? Thank you in advance!

you could get all checkboxes, using:

var cBoxEles = document.querySelectorAll('input[type="checkbox"])');
//and loop thru it
for (var i=0, len = cBoxEles.length; i < len; i++){
    console.log(cBoxEles[i].name);
}

In your case, I think you can see the reference. If you select it with jQuery, I think it will be more specific and convenient.

How to get all elements which name starts with some string?