Closed Thread Icon

Topic awaiting preservation: variable value as new variable (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8230" title="Pages that link to Topic awaiting preservation: variable value as new variable (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: variable value as new variable <span class="small">(Page 1 of 1)</span>\

 
maninacan
Paranoid (IV) Inmate

From: Seattle, WA, USA
Insane since: Oct 2001

posted posted 07-04-2002 01:20

ok so I have a variable which contains a string. Now I want that string and another string to be put together and then call the function that they make.

like this:

var blah = "home";
(somehow combine the value of blah with "Fader.fadeIn();")
(now somehow call the string that was made which would be "homeFader.fadeIn();")

Maninacan Cell #471
kewl
Mad Scientists

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 07-04-2002 02:02

well the default would be an eval

eval(blah+"Fader.fadeIn();")
but we dislike evals because they are CPU hogs

Preferable would be when you are creating your "Fader" objects you pass it some sort of var that will switch what the "fadeIn" method for that object does.



.:[ Never resist a perfect moment ]:.

maninacan
Paranoid (IV) Inmate

From: Seattle, WA, USA
Insane since: Oct 2001

posted posted 07-04-2002 02:44

thank you, I was thinking that it was parse(); for some reason.

Maninacan Cell #471
kewl
Mad Scientists

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 07-04-2002 19:51

It's also possible that

window[blah + 'Fader'].fadeIn();

would work, but I wouldn't blame you for using eval here.

« BackwardsOnwards »

Show Forum Drop Down Menu