bjblackmore
Programmer
Hi
I have the following javascript...
<SCRIPT LANGUAGE="JavaScript">
var checkflag = "false";
function check(field) {
if (checkflag == "false" {
for (i = 0; i < field.length; i++) {
field.checked = true;}
checkflag = "true"; }
else {
for (i = 0; i < field.length; i++) {
field.checked = false; }
checkflag = "false"; }
}
</script>
executed using..
<input type=checkbox value="true" onClick="check()" name="delete">
However it does work when I have multiple checkboxs in the form of arrays i.e.
<input type="checkbox" name="checkbox[0]" value="abc">
<input type="checkbox" name="checkbox[1]" value="def">
<input type="checkbox" name="checkbox[2]" value="ghi">
Does anyone know how to get the javascript to recognise checkbox[]?
Many Thanks
Ben
I have the following javascript...
<SCRIPT LANGUAGE="JavaScript">
var checkflag = "false";
function check(field) {
if (checkflag == "false" {
for (i = 0; i < field.length; i++) {
field.checked = true;}
checkflag = "true"; }
else {
for (i = 0; i < field.length; i++) {
field.checked = false; }
checkflag = "false"; }
}
</script>
executed using..
<input type=checkbox value="true" onClick="check()" name="delete">
However it does work when I have multiple checkboxs in the form of arrays i.e.
<input type="checkbox" name="checkbox[0]" value="abc">
<input type="checkbox" name="checkbox[1]" value="def">
<input type="checkbox" name="checkbox[2]" value="ghi">
Does anyone know how to get the javascript to recognise checkbox[]?
Many Thanks
Ben