Hi again gio,

some explanation on:
Event.observe(window, 'load', function() {

The first Event.observe register the handler function
function() {

so when the event is launched, you want to observe another event, but
the computeTotalForTable is automatically executed
because computeTotalForTable('cities') launch the function and return
what retuen the function, instead of computeTotalForTable that return
the function to be launched after the event apear.

hope it'll be more clear :))


On 27 mai, 17:31, gio <giov...@gmail.com> wrote:
> Hi All,
> I am new to prototype and I need a bit of an explanation on
> Event.observe please - I have used it several times and it's been ok -
> Now I have a function that builds a table row on the fly but it's
> behaving a bit strange. (I can paste the code of the function if
> needed - it's taken from the fabulous book "Practical Prototype and
> script.aculo.us "  ).
> I could not get it to work with this line of code:
> Event.observe(window,'load',computeTotalForTable('cities'));
> After searching on the prototype site I found out this solution but I
> don't understand why this works:
> Event.observe(window, 'load', function() {
>   Event.observe(window,'load',computeTotalForTable('cities'));
> });
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 prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to