added 3rd option
<SCRIPT LANGUAGE="JavaScript">
var checkflag = "false";
function check(field) {
if (checkflag == "false") {
for (i = 0; i < field.length; i++) {
field[i].checked = true;
}
checkflag = "true";
return "Uncheck All";
} else {
for (i = 0; i < field.length; i++) {
field[i].checked = false;
}
checkflag = "false";
return "Check All";
}
}
function test()
{
myname.list[0].checked = true;
}
function test2(checkboxnum)
{
this.checkboxnum = checkboxnum
myname.list[checkboxnum].checked = true;
}
function test3(checkboxnum)
{
this.checkboxnum = checkboxnum
myname.elements[checkboxnum].checked = true;
}
</script>
<form name="myname">
<input type=checkbox value="Check All"
onClick="this.value=check(this.form.list)">
<input type="checkbox" name="list" value="thisisdifferentforeach">
<input type="checkbox" name="list" value="thisisdifferentforeach">
<input type="checkbox" name="list" value="thisisdifferentforeach">
..
..
..
</form>
<a href="javascript
:test()">turn on the checkbox list 0</a>
<br>
or
<br>
<a href="javascript
:test2('0')">turn on the checkbox list 0</a>
<br>
or
<br>
<a href="javascript
:test3('0')">turn on the checkbox list 0</a>
"Lasse Reichstein Nielsen" <lr*@hotpop.com> wrote in message
news:4q**********@hotpop.com...
"szar" <no**@nowhere.net> writes:
I'm passing numerous array elements called list[] when a form is
submitted. the brackets [ ] are necessary for PHP to see all the values as an
array. The problem is I can't seem to reference the form elements from
javascripts because of the brackets. For example,
form.list[].value is no good. Anyone know a way around this? Thanks.
<URL:http://jibbering.com/faq/#FAQ4_25>
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'