Le 10/3/08 6:35 PM, laredotornado a écrit :
Hi,
I have a select menu on my page. What is the easiest way to get the
VALUE attribute of each of the options starting from index 1 and put
all those into their own array? If iterating over the options array
using a for loop is the answer, that's fine, I just thought there may
be some function out there I hadn't thought of.
Why do you need your options in an array ?
They already are a collection, what would you get more if they become an
array?
var o = document.forms[0].mySelect.options;
for(var i=1; i<o.length; i++;)
if(o[i].value == 'something') alert('found');
anyway to xfer the collection in an array that's done very easily :
var n = []
var o = document.forms[0].mySelect.options;
for(var i=1; i<o.length; i++;) n.push(o[i].value);
and then ?
--
sm