Hello,
I use the following syntax for a function which receives an HTML element name and turns all the checkboxes that named after this name checkedclear if it’s a checkbox.
[QUOTE]
function checkAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = true ;
}
function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
field[i].checked = false ;
}
I call the functions when the users presses the following buttons:
[code=html]
<tr><td><input type=”button” value=”Check all” name=”checkall” onClick=”checkAll(document.document.aut)”></td><td><input type=”button” value=”Uncheck all” name=”uncheckall” onClick=”uncheckAll(document.document.aut)”></td></tr>
It works just fine when i use the following syntax for the checkboxes:
[code=html]
<tr><td><input type=”checkbox” name=”aut” value=”1″></td><td></td></tr>
But when i add ‘[]’ at the end of the names, and at the parameter that i send to the function it sises to work…
I use PHP to process this form and i have to use square brackets to automatically order all the values of the checked checkboxes in a array.
Here the source that doesn’t works looks…
[code=html]
<tr><td><input type=”checkbox” name=”aut[]” value=”1″></td><td><td></tr>
<tr><td><input type=”button” value=”Check all” name=”checkall” onClick=”checkAll(document.document.aut)”></td><td><input type=”button” value=”Uncheck all” name=”uncheckall” onClick=”uncheckAll(document.document.aut)”></td></tr>
I’ll highly appreciate any help…