rhinst
07-23-2003, 03:40 PM
Hi,
A selectbox I'm using in one of my forms has brackets characters in the name. I need to do this in order to take advantage of the "Multiple" property when I parse the results in PHP.
My question is this: what would be the best way to access the selected index in javascript. The following code does not work (I supposed javascript is attempting to interpret "select_name" as an array - which seems like a reasonable assumption for it to have made , but doesn't help me out any).
value = document.form_name.select_name[].selectedIndex
I've also tried the following snippets without success:
value = document.form_name.elements["select_name[]"].selected Index
and
value = document.form_name.elements["select_name\[\]"].selected Index
Thanks in advance,
Rob
A selectbox I'm using in one of my forms has brackets characters in the name. I need to do this in order to take advantage of the "Multiple" property when I parse the results in PHP.
My question is this: what would be the best way to access the selected index in javascript. The following code does not work (I supposed javascript is attempting to interpret "select_name" as an array - which seems like a reasonable assumption for it to have made , but doesn't help me out any).
value = document.form_name.select_name[].selectedIndex
I've also tried the following snippets without success:
value = document.form_name.elements["select_name[]"].selected Index
and
value = document.form_name.elements["select_name\[\]"].selected Index
Thanks in advance,
Rob