On 4/16/06, Maninder, Singh <[EMAIL PROTECTED]> wrote:

> See the following extract from www.sergiopereira.com -

> In case you've tried it before, you know it doesn't work. The reason is that
> the script block will be evaluated, and evaluating a script like the above
> will not create a function named sayHi.

This is wrong wrong wrong. The function WILL be created but not in the
scope some expect it to. Didn't we discuss the scope of the evaluation
just the other day?

> sayHi = function(){

It would be saver to use window.sayHi, as the above version depends on
that there is no sayHi symbol in the scopes up until the global scope.
You might overwrite one of the String or Ajax object members.

BUT: This is how it works on any browser. If the eval works in one, it
works in any. Therefore I do not think this is the problem, as he just
calls a global function. Probably, the function just fails, so he
should check with the javascript console and use alerts liberally for
debugging.

Bye,
  Martin
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to