This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Reflection for js? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Reflection for js?" Watch "Reflection for js?" New topic
Author

Reflection for js?

graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Is there a way to pass in the name of a method and have javascript execute it?

Something like reflection.

Thanks.


write, revise, re-write, revise, again...<br />write, revise, re-write, revise, again...
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41135
    
  45
There is the "eval (string)" method, which evaluates its argument as if it were JavaScript code.
[ May 24, 2006: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60794
    
  65

Consider the following:



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
graham king
Ranch Hand

Joined: Dec 30, 2004
Posts: 133
Thanks Ulf,

Worked like a charm!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reflection for js?
 
Similar Threads
How to get an specific object instance!
print a parameter name and value (with a function)
Is possible to get variable name in java?
EL Mystery
What is meant by .class ?