What you're doing in the first example is essentially just passing a string in as the 3rd param, where it's expecting a function pointer. It works in your eval because the whole statement is constructed as a string and then interpreted.

If you are working in a object oriented context... where "myObj" is some object which has a function named "doSomething", the following will work, as it will return a pointer to the myObj.doSomething function... if you are working with a only globally scoped functions, try replacing "myObj" with "window" below...

Event.observe(node.getAttribute('id'), fun.getAttribute('action'), myObj[fun.getAttribute ('do')] );



On 11/8/06, James <[EMAIL PROTECTED]> wrote:

err... so, it works using eval

eval("Event.observe(node.getAttribute('id'),fun.getAttribute('action'),"+fun.getAttribute("do")+")");

I'm going to run with this for now, but I like to avoid eval so if
anyone has a better idea get at me.

Thanks,
James


http://www.someElement.com
--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to