> That would be considered an abuse of eval by most, bracket notation is
> a much more appropriate solution.

You're quite right, I was thinking the general case of turning text
into executable code at runtime, but the OP's question was
specifically about object names -- the other responses were definitely
more on-target!
--
T.J. Crowder
tj / crowder software / com

On Oct 14, 3:23 am, RobG <[EMAIL PROTECTED]> wrote:
> On Oct 13, 5:24 pm, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > JavaScript provides the eval() function for this.
>
> That would be considered an abuse of eval by most, bracket notation is
> a much more appropriate solution.
>
> <URL:http://www.jibbering.com/faq/#propertyAccessAgain>
>
> All objects can be referenced as a property of some other object
> except for the global object (which is essentially the window object
> in browsers).
>
> You can get a reference to the global object by assigning this to a
> global variable in the global scope at the very start of a script as
> follows:
>
>   var _global = this;
>
> or from anywhere using:
>
>   var _global = (function() { return this})();
>
> and then:
>
>   _global['someString']
>
> will refer to the global property 'someString' (essentially
> window['someString']).
>
> --
> Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to