Using code almost verbatim from the manual <body onload="hideMenus()"> function hideMenus() { array_to_hide = $A($(''Links_Sub'').previousSiblings()); array_to_hide.each(Element.Hide); } Links_Sub and it''s previous siblings are submenus that need to hide and appear on roll-over of other links. I''m keeping them shown in the original CSS style and using hide here. Testing this in firefox on a vista box, I''m getting: iterator is not a function. This is my first time using prototype, so it may be something easy to fix. Has anyone experienced this, can anyone provide assistance? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
First of all, it''s Element.hide (lowercase) Second, there''s a special enumerable method for invoking a method on a collection of elements - http://prototypejs.org/api/enumerable/invoke invoke Third, there''s no need for $A, since previousSiblings() extends elements automatically. Something like this ahould do it: function hideMenus() { $(''Links_Sub'').previousSiblings().invoke(''hide''); } P.S. In my recent post I explain how to solve such common thing as iterating over menu items. http://thinkweb2.com/projects/prototype/2007/08/28/extending-the-limits/ Hope it helps -- View this message in context: http://www.nabble.com/Prototype-Iterator-tf4388742.html#a12513729 Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you for the help. I''ve added your blog to my google homepage it looks like it will proove incredibly useful. On Sep 5, 8:44 pm, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> First of all, it''s Element.hide (lowercase) > Second, there''s a special enumerable method for invoking a method on a > collection of elements - http://prototypejs.org/api/enumerable/invoke > invoke > Third, there''s no need for $A, since previousSiblings() extends elements > automatically. > > Something like this ahould do it: > > function hideMenus() { > $(''Links_Sub'').previousSiblings().invoke(''hide''); > > } > > P.S. In my recent post I explain how to solve such common thing as iterating > over menu items.http://thinkweb2.com/projects/prototype/2007/08/28/extending-the-limits/ > Hope it helps > > -- > View this message in context:http://www.nabble.com/Prototype-Iterator-tf4388742.html#a12513729 > Sent from the RubyOnRails Spinoffs mailing list archive at Nabble.com.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---