Arrays

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Does anyone know how to fill a out of an array?

Something like:

for (i=0; i < 2; i++)
if (data[i] != null)document.form.WhatDoIPlaceHere?.value = data[i];

thanx in advance,

Shakespeare: onclick || !(onclick)

They have: 601 posts

Joined: Nov 2001

What you using, javascript? I'm guessing that you would use:

for (i=0; i < 2; i++)
if (data[i] != null)document.form.selectname.value = data[i];

Replace selectname with the NAME value of your SELECT tag, i.e., in the following example you would replace selectname with hello.

...

- wil

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

Sorry... using Javascript indeed Smiling

Anyway thanx a lot! Didn't use your solution but it made me think of another one Smiling

[EDIT:] this is the solution I used, as I wanted the option.value to differ from the item shown:

document.write("<option value="+crunch[j+1]+">"+crunch[j]);
'
[/EDIT]

Thanx,

Shakespeare: onclick || !(onclick)

They have: 601 posts

Joined: Nov 2001

Great! Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.