hi guys,

help me with this one..

I have a php code to loop a checkbox; 3 checkboxes.

<?php
for($id=1;$id<=3;$id++){
echo "<input type='checkbox' value='$id' id='check_$id' name='checkboxes'/>";
}
?>

Result:
<input type='checkbox' value='1' id='check_1' name='checkboxes'/>
<input type='checkbox' value='2' id='check_2' name='checkboxes'/>
<input type='checkbox' value='3' id='check_3' name='checkboxes'/>

now, i want to create a javascript or jquery codes to get whether the checkboxes are checked using onlick function.

maybe something like this.

<a href="#" onclick="actionDelete()" />

function actionDelete(){
if(document.getElementsByName("checkboxes").checked == true){
document.mainform.action = "include/db/delete/deleteSelected.php";
document.mainform.submit();
}else{
alert("Please check some checkboxes for deleting");
}
}

my form name is mainform.. if i use getElementById(), then i shud also create a for loop. but i dont want to create a for loop.

i know its easy.. so help me... Beginner!