[thelist] JS array or something else?
Tom Dell'Aringa
pixelmech at yahoo.com
Wed Nov 6 14:15:00 CST 2002
Hey all,
I need to add a new option to a select list each time a button is
pressed. This will add the next letter: i.e. a, b, c, d and so on. A
is already populated as the first item in the list.
The way I figured I should do this is possible build an array, but
what I really need is a key/value pair I think. I want to be able to
know that:
2 = b
3 = c and so on (0 = default selection, 1 = a)
Can anyone give me a jump on this? I'm not sure even how to do it
with an array. Here is my function without the part I need:
function addRequest()
{
var form = document.forms['selectRequest'];
var selectObj = form.elements['selectRequestDrop'];
var len = selectObj.options.length;
selectObj.options[len] = new Option(len);
}
This gives me a new option with 2, 3, 4 and so on - I just need to
match that to the letters.
TIA
Tom
=====
var me = tom.pixelmech.webDeveloper();
http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]
__________________________________________________
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/
More information about the thelist
mailing list