Hello,
As this forum has been so helpful before, this time it's a JS question:
I have a list of checkboxes from which the user can select 1 or more to check and perform an action upon.
Thus, all checkboxes have the same "name" (in ASP code, since it's DB-related):
response.write "<input type=checkbox name=""FieldName"" value="&obj("OrderID").value&">"
I call JS using a button:
<img src="images/TrashBin.png" border=0 onclick="Delete(document.FormName.FieldName)">
Which is supposed check which checkbox is checked using this JS code:
function DeleteEntry(field){
for (i = 0; i < field.length; i++) {
if (field[i].checked) {
action...
}
}
}
Problem: if I have more than 1 checkbox, it works fine.
BUT if I have just 1 checkbox, both field.length and field.checked are "undefined" and so I can't check if the one checkbox is checked or not.
Any ideas?
Thanks in advance,
Asaf