Thorsten Scherler wrote:
On Wed, 2005-08-24 at 16:45 -0500, Antonio Gallardo wrote:
AFAIK, Thorsten already tried eval() and does not work. :-(
Yeah, Antonio is right.
The eval() gives "Calling eval() with anything other than a primitive
string value will simply return the value. Is this what you intended?".
...and that is not what I was intended. ;-)
Hmm, you're right, I just tried it myself and got the same thing.
eval() must be broken in Rhino.
Another possibility: use the "new Function(string)" constructor to
create a function from a string and then call it, for example:
var evalFunc = new Function("string of JS code to evaluate here");
evalFunc();
If you want to pass particular arguments to it you can do that too; more
details at
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Function#Created_By