I have this in my code: <input type="checkbox" name="tack[]" value="<?echo odbc_result($rs3,"dTackID");?>">
I'm passing this to a javascript function like this to check all checkboxes: onClick="this.src = check(document.forms[0].elements['horse[]'], document.forms[0].elements['trailer[]'], document.forms[0].elements['tack[]'])" My problem is this...if there are two horse/trailer/tack checkboxes on the page...it will check/uncheck them fine. However, if there is only one element in the array when passed in, it will do nothing to the checkbox. No errors show up or anything, just nothing happens to the lone checkbox. Here is the javascript code for those interested: <SCRIPT LANGUAGE = "JavaScript"> var checkflag = "false"; function check(field, field1, field2) { if (checkflag == "false") { if(field) { for (i=0; i<field.length; i++) {field[i].checked = true;} } if(field1) { for (i=0; i<field1.length; i++) {field1[i].checked = true;} } if(field2) { for (i=0; i<field2.length; i++) {field2[0].checked = true;} } checkflag = "true"; return "images/button_unselectall.gif"; } else { if(field) { for (i=0; i<field.length; i++) {field[i].checked = false;} } if(field1) { for (i=0; i<field1.length; i++) {field1[i].checked = false;} } if(field2) { for (i=0; i<field2.length; i++) {field2[i].checked = false;} } checkflag = "false"; return "images/button_selectall.gif"; } } </script> If you can help that would be great, thanx in advance, Kit _________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php