File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Reflection for js?" Watch "Reflection for js?" New topic

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.


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

Joined: Mar 22, 2005
Posts: 39549
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 - updated with new look and Ping home screen widget
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60059

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:
subject: Reflection for js?
Similar Threads
What is meant by .class ?
print a parameter name and value (with a function)
How to get an specific object instance!
EL Mystery
Is possible to get variable name in java?