Reply to Re: Help with Javascript: naming variables using other variables

Your name:

Reply:


Posted by Jonathan N. Little on 11/06/05 18:54

sagejoshua wrote:

> Help!
>
> Is there a way to declare a variable name using other variables in
> Javascript? In PHP, it's done with something like:
>
> <?php
>
> $var1 = "foo";
> ${$var1.bar} = "great!";
>
> print $foobar;
>
> // Outputs "great!"
>
> ?>
>
> Is there a similar method in Javascript?
>
> Thanks.
> Josh

var foo="Value of Foo";
var bar="foo";
alert( "foo=" + foo + "\n evail of bar=" + eval(bar) );


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация