
June 5th, 2001, 02:44 PM
|
|
Junior Member
|
|
Join Date: Jun 2001
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
javascript and multiple select
Hi,
I have several <select name="name1[]" multiple> that each contains several options.
What I want is to see if a sertain option is selected. The problem is that I don't know how to do that if the name of the select have [] at the end.
I've managed to do this if I don't add [] at the end of the name, but then I can't send all the values if I select several, becouse it only sends the last selected value and treats it as a string, not an array:
function check_write(value) {
if (value.options[1].selected == 0) {
theform.manage.options[1].selected = 1;
}
}
....
<select name="manage" onChange="check_write(this);">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
What I need to know is how I can do a script that works as the one above, but treats the select (manage) as an array instead of a string.
Thanks,
Martin Henriksson
|