Hi everyone. i'll also be posting this in the javascript forum.
I have a bunch of check boxes in my html.
<form name=myform>
<input type=checkbox name=list[] value="1">1<br>
<input type=checkbox name=list[] value="2">2<br>
<input type=checkbox name=list[] value="3">3<br>
<input type=checkbox name=list[] value="4">4<br>
<input type=checkbox name=list[] value="5">5<br>
</form>
as you can see the name is list[] so that when i bring it to a php script it can be referenced as an array.
But how can i reference the list[] checkbox using javascript? if anyone has experience doing this.
here is my code so far which i've experiented with.
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var field=document.myform.elements[0];
alert(document.myform.elements["list[]"][0].name);
// tried document.myform.list[][0].name
// tried document.myform.'list[]'[0].name
// tried document.myform.elements[0][0].name
// End -->
</script>
any help would be appreciated thanks.
I have a bunch of check boxes in my html.
<form name=myform>
<input type=checkbox name=list[] value="1">1<br>
<input type=checkbox name=list[] value="2">2<br>
<input type=checkbox name=list[] value="3">3<br>
<input type=checkbox name=list[] value="4">4<br>
<input type=checkbox name=list[] value="5">5<br>
</form>
as you can see the name is list[] so that when i bring it to a php script it can be referenced as an array.
But how can i reference the list[] checkbox using javascript? if anyone has experience doing this.
here is my code so far which i've experiented with.
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var field=document.myform.elements[0];
alert(document.myform.elements["list[]"][0].name);
// tried document.myform.list[][0].name
// tried document.myform.'list[]'[0].name
// tried document.myform.elements[0][0].name
// End -->
</script>
any help would be appreciated thanks.