I want to call an event handler by program, what is the better way ? 1 - Write a event handler which handles program call : init() { $(''my_button_1'').observe(''click'',my_handler); $(''my_button_2'').observe(''click'',my_handler); ... my_handler($(''my_button_1'')); ... my_handler(elt) { //elt is a element or a event if(!elt.id) elt=Event.element(elt); elt.addClassName(''selected''); etc...; } } 2 - Call my event handler with a ''fake'' event : init() { $(''my_button_1'').observe(''click'',my_handler); $(''my_button_2'').observe(''click'',my_handler); ... my_handler({target:$(''my_button_1'')}); ... my_handler(evt) { //evt is an event elt=Event.element(evt); elt.addClassName(''selected''); etc...; } } Or is there another solution ? Thank you --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---