||__Uday__|| wrote:
> ...
> Event.observe(window, 'load', fCall1, false);
> Event.observe(window, 'load', fCall2, false);
> Event.observe(window, 'load', fCall3, false);
> ...
> Using above code, I get different order of event firing in IE and
> Firefox
> Firefox: 1,2,3 but in
> IE(weird): 2,3,1
>
> how can I get the same order in both IE and Firefox.
>
I believe the order for attached events is by specification _not
guaranteed_. Event.observe() uses the DOM methods attachEvent and
addEventListener. If you need a guaranteed order, you'll have to attach
a function that calls the three in succession. e.g.
function fCallAll() {
fCall1(); fCall2(); fCall3();
}
Event.observe(window, 'load', fCallAll);
If you don't know which functions need to be called, you could create a
wrapper class to fire events more generally. A myriad of ways exist.
Here are some full featured event classes:
http://encytemedia.com/blog/articles/2006/02/08/working-with-events-in-prototype
http://livepipe.net/projects/object_event/
http://www.truerwords.net/articles/web-tech/custom_events.html
-- Ken Snyder
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---