Click to See Complete Forum and Search --> : checkbox - names 'arr[1]', 'arr[26]', ...


Magoi
09-11-2003, 01:02 PM
Hi.

How I do to access the methods of the checkbox ?
For example, if it was checked or not?

---------------------------------------------
< form name=formName action=# method=post onSubmit="return test()">

< input type=checkbox name=arr[4] value=2> in 4
< input type=checkbox name=arr[10] value=5> in 10
< input type=checkbox name=arr[26] value=2> in 26
< br>

< input type=submit name=buton value='ok'>

< /form>
-----------------------------------------------
I can't see nothing!
------------------------------
< script>
function test() {
alert(document.formName.arr[4].value);
return false;
}
< /script>
------------------------------

More one thing: I can't change the values names the checkboxes!

It's possible ?!

Thanks.
Magoi

Fang
09-11-2003, 01:48 PM
document.formname.elementname.value
or
document.forms[index].elements[index].value
or
a combination of the two.

Please use quotes:
<input type="checkbox" name="arr[4]" value="2">

Magoi
09-11-2003, 02:07 PM
ok.

i will try.

thanks.