The name of the checkboxes are actually delmessageid[] but if I put that in there, it says "syntax error". Currently the way it works is when you click it, the error is "length is null or not an object". I'm guessing that's because I didn't add the [] on to the name of my field. How can I get around this to make this work properly?
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
checkboxes don't have a length property, from what I remember. You'll have to iterate over them. You can uniquely name them, or just iterate over their offsets in the form's elements array...
The code works fine with the checkbox names being delmessageid , but I need them as delmessageid[] so I can pass the values in an array
When I do this I get a "syntax error" on "onClick="function(this.form.delmessageid[]);"
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
it's not a legal object name you can reference like the normal name. As I said, iterate over the elements of the array. You could also use unique id's and use getElementById()
function checkAll(field)
{
for (i = 0; i < 25; i++)
document.getElementById("checkbox").checked = true ;
}
This checks the first one only and doesn't appear to be looping.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
they all have the same ID, getElementById will only fetch the first one it finds. As I said, name them all uniquely or just iterate the elements array of the form object.