On Dec 3, 8:17 pm, yoshi <[EMAIL PROTECTED]> wrote:
> heres my js:
>
> var stuff7=eval('function() {alert("stuff..");}')
Umm... that looks like a SyntaxError to me. Function declaration
requires an identifier (aka function name). Either that or turn it
into an expression by wrapping with parentheses:
eval('(function(){ alert(\'stuff\') })')(); // alerts 'stuff'
>
> when i alert stuff7 it is undefined.
>
> now if i do this:
> eval('var stuff7=function() {alert("stuff..");}')
>
> and alert stuff7, it is defined
>
> does anybody know y, the jscript eval doc doesnt really help, i
> suspect it is a scope issue?
Other than that, I assume you know that `eval` is evil ; )
--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" 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/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---