Hi gio,

Try
Event.observe(window, 'load', function() {
  computeTotalForTable('cities');
});
Because the way you write the function, the computeTotalForTable is
executed at initialization time of the Event.observe, so before the
window is loaded.
As it is said in the doc, you should provide an handler function, so
you could also have done this way:
Event.observe(window,'load',computeTotalForTable);

--
david

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 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to