-
variables from variables
im tyring to use the value of one variable to provide part of the value for another.
----
var city = london;
var citytext = londontext;
var citybg = londonbg;
highlight(city,citytext,citybg);
----
the code above works- but im trying to avoid having to type in all three fields since they all include the word 'london'.
but when i try:
----
var city = london;
var citytext = city+text;
var citybg = city+bg;
highlight(city,citytext,citybg);
----
it doesnt work.
how should i be doing this?
-
a.k.a gltovar
var city = london;
var citytext = city+text;
var citybg = city+bg;
should be
var city = london;
var citytext = eval(city+"text");
var citybg = eval(city+"bg");
hopefully that works
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|