Log in

View Full Version : Replace string with variable



Sysmic Wave
07-17-2009, 03:42 PM
Hi folks,

This is probably a really simple answer but for the life of me I just can't get it.

I'm trying to populate a <select> on run time. I've defined a variable and given it a value and I want to replace the new option string with the value in the variable. Here is the code:


test.options[test.options.length]=new Option("a new option")

I want to remove the "a new option" string and replace it with:


test.options[test.options.length]=new Option(myvariable)
Any ideas?

Thanks

Sysmic Wave
07-17-2009, 04:35 PM
Oops, just realised what i've done.

Cheers for looking anyway.

Mods, can you close this please.

Cheers