faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

I have a variable "i". I want that variable to change name of other variable. like $$var in php.

Apr 9th, 2008 20:10
ha mo, Dave Clark, paziek lodziarz,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Paziek,
     Sounds like you mean you have the name of a variable as the value 
of yet another variable and you wish to get the value of the embeded 
variable.  This is one of the only two valid uses of the 
JavaScript "eval()" method:
var i = 3;
var g = "i";
alert(3 + eval(g));
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.healthinhealth.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com