['submenu_reports', 'submenu_forms', 'submenu_tickets'].map($).invoke('hide');
cheers
On 10/19/06, Thomas Fuchs
<[EMAIL PROTECTED]> wrote:
You can also do:
$aMenus.each(Element.hide);
this way, each item of the array will get passed into a Element.hide
() call,
no need for the extra inline function definition.
Best,
Thomas
Am 19.10.2006 um 00:00 schrieb Keith Davis:
>
> Never mind. It was just a typo. It should have been
> submenu_reporting. Duh.
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Christophe
> Porteneuve
> Sent: Wednesday, October 18, 2006 4:34 PM
> To: [email protected]
> Subject: [Rails-spinoffs] Re: Using array.each with Element.hide
>
>
> Hey Keith,
>
> First, you might want not to name your variables with leading $'s.
> It's
> not idiomatic JS. Basically, $-vars are the realm of PHP :-)
> Perusing your
> script a first time, I was confused as to the language context :-D
>
> Keith a écrit :
>> function ShowMenu($sMenu){
>>
>> var $aMenus = new Array();
>> $aMenus = ['submenu_reports',
> 'submenu_forms',
>> 'submenu_tickets'];
>
> First, you can put this in one line: your new Array() never gets used.
>
>> $aMenus.each( function($s){ Element.hide($s);
> })
>>
>> Element.show($sMenu);
>>
>> }
>>
>> The error I get it is style is null or not an object. If I swap out
>> Element.hide for alert, it works fine.
>
> Where do you get this? The final show line? Then we'd have to
> know what is
> being passed to your ShowMenu function... If it's in the anonymous
> function
> (hide calls), double-check the IDs in your array against the actual
> DOM of
> your page.
>
>
> --
> Christophe Porteneuve a.k.a. TDD
> "[They] did not know it was impossible, so they did it." --Mark Twain
> Email: [EMAIL PROTECTED]
>
>
>
> >
--
Thomas Fuchs
wollzelle
http://www.wollzelle.com
questentier on AIM
madrobby on irc.freenode.net
http://www.fluxiom.com :: online digital asset management
http://script.aculo.us :: Web 2.0 _javascript_
http://mir.aculo.us :: Where no web developer has gone before
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
- [Rails-spinoffs] Re: Using array.each with Element.hid... Thomas Fuchs
- [Rails-spinoffs] Re: Using array.each with Elemen... Siegfried Puchbauer
- [Rails-spinoffs] Re: Using array.each with El... Keith Davis
- [Rails-spinoffs] Re: Using array.each with Elemen... Drew Taylor
- [Rails-spinoffs] Re: Using array.each with Elemen... Keith Davis
