Thanks Joe, but $(itemId) behaves the same way as itemId. I've solved it by using Insertion.Before instead of direct innerHTML but I still don't understand what was wrong with my code... Anyone can help me explain it?
On Saturday, April 29, 2006, at 7:13 PM, Joseph Potenza wrote: >Try this: > >Event.observe($(itemId),'mouseover', >this.onMouseOverHandler.bindAsEventListener(this),false); > >- Joe > >On 29 Apr 2006 20:59:24 -0000, Thomas Anderson < >[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> I have a class 'Menu' with a method 'addItem'. The method (simplified) >> looks like this: >> >> addItem: function(itemId, text) >> { >> this.container.innerHTML += '<div id="'+itemId+'">'+text+'</div>'; >> Event.observe(itemId, 'mouseover', >> this.onMouseOverHandler.bindAsEventListener(this), false); >> } >> >> I call my class in the following way: >> >> var myMenu = new Menu(); >> myMenu.addItem('item1', 'Item 1'); >> myMenu.addItem('item2', 'Item 2'); >> myMenu.addItem('item3', 'Item 3'); >> >> And here comes the mystery: only the last item (item3) triggers the >> 'onMouseOverHandler' listener. When I remove item3, than it's trigged by >> item2 and so on... >> >> Anyone have a solution? Thank you in advance! >> >> Thomas >> >> >> >> >> -- >> Posted with http://DevLists.com. Sign up and save your mailbox. >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > > >_______________________________________________ >Rails-spinoffs mailing list >Rails-spinoffs@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > -- Posted with http://DevLists.com. Sign up and save your mailbox. _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs