Select a certain amount of checkbox arrays on the page
- by Joris Tobebech
Hi guys,
so i wrote a function to select a certain amount of checkboxes on the page, the number retrieves fine when i message box it but no checkboxes are checked.
here is my function
function checkAmount(number)
{
alert(number);
var boxes = document.getElementsByTagName("input");
for (var i = 0; i < number; i++) {
if (boxes[i].name == "vote[]") {
boxes[i].checked = true;
}
}
}
and here is my execution code
OnClick="checkAmount(document.getElementById(\'ammount\').value)"