View Full Version : Fighting the arrays

04-10-2003, 10:13 PM
Hi there
I’ve got two <select>-boxes. The second box changes options according to the first <select>. This works fine, but how do I attach values, in this case URL’s, to the second <select>? Normally this wouldn’t be a problem, but since this script works with arrays it confuses me.
I found the script on the internet.

Check out 'my' script (http://www.larsliin.dk/test.htm)

04-10-2003, 10:46 PM
Its not really clear what you are asking for....
maybe try something like this..

function addOption(){
temp =new Array()
for (a=0; a<document.f.s.options.length; a++){
temp[a] = document.f.s.options[a].text
temp[temp.length]= document.f.t.value
for (b=0; b<temp.length; b++){
document.f.s.options[b]=new Option(temp[b])
<INPUT TYPE=text name=t>
<INPUT TYPE=button onclick=addOption() value="add option >>">

:) hope its helpful :)

04-10-2003, 11:00 PM
Thanks, but not exactly what I was looking for - or perhaps I'm missing out on something here?
Check out my form: http://larsliin.dk/test.htm

When I choose one of the options in the right box, I need to go to an URL. I need to attach values to the options. This is difficult since the right box works with arrays. How can this be solved?