[Proto-Scripty] Re: Using a string as object name?

2008-10-14 Thread T.J. Crowder
> 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 d

[Proto-Scripty] Re: Using a string as object name?

2008-10-13 Thread RobG
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. http://www.jibbering.com/faq/#propertyAccessAgain > All objects c

[Proto-Scripty] Re: Using a string as object name?

2008-10-13 Thread Matt Foster
If your variable is global, as in a direct property of the window, you can access your variable by using square brackets. var myObject = { something : "else" }; alert(window["myObject"].something); On Oct 13, 2:24 am, "T.J. Crowder" <[EMAIL PROTECTED]> wrote: > Hi, > > JavaScript provides the

[Proto-Scripty] Re: Using a string as object name?

2008-10-13 Thread T.J. Crowder
Hi, JavaScript provides the eval() function for this. Google "javascript eval" to find some references. HTH, -- T.J. Crowder tj / crowder software / com On Oct 13, 1:09 am, Charles <[EMAIL PROTECTED]> wrote: > Is there any possible way with Prototype to parse the content of a > string in refer