I''m sure it''s simple, but why doesn''t this work? function ShowMenu($sMenu){ var $aMenus = new Array(); $aMenus = [''submenu_reports'', ''submenu_forms'', ''submenu_tickets'']; $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. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
It''s just easier for the me to read with variables using a $. I know it''s not necessary, but neither is the ;. Sorry, I am a PHP guy for sure. What do you mean where do I get the final show line? It''s a function of prototype. Maybe I don''t know what you are asking. The $aMenus.each( function($s){Element.hide($s); }) is the problem. I the show line works fine, and when the each part is removed, I don''t get an error. Also, if I substitute the Element.hide($s) for alert($s), it works fine (I get three alert boxes, 1 for each array element.) -----Original Message----- From: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Christophe Porteneuve Sent: Wednesday, October 18, 2006 4:34 PM To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Never mind. It was just a typo. It should have been submenu_reporting. Duh. -----Original Message----- From: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Christophe Porteneuve Sent: Wednesday, October 18, 2006 4:34 PM To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Christophe > Porteneuve > Sent: Wednesday, October 18, 2006 4:34 PM > To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 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: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > > > >-- 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 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 -~----------~----~----~----~------~----~------~--~---
or that way ;) [''submenu_reports'', ''submenu_forms'', ''submenu_tickets''].map($).invoke(''hide''); cheers On 10/19/06, Thomas Fuchs <t.fuchs-moWQItti3gBl57MIdRCFDg@public.gmane.org> 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: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Christophe > > Porteneuve > > Sent: Wednesday, October 18, 2006 4:34 PM > > To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > > 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: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > > > > > > > > > > -- > 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 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 -~----------~----~----~----~------~----~------~--~---
On 10/19/06, Thomas Fuchs <t.fuchs-moWQItti3gBl57MIdRCFDg@public.gmane.org> wrote:> > You can also do: > > $aMenus.each(Element.hide);Nice! I never would have thought of that. :-) Drew -- ---------------------------------------------------------------- Drew Taylor * Web development & consulting Email: drew-sYRLyna/r5E+Va1GwOuvDg@public.gmane.org * Site implementation & hosting Web : www.drewtaylor.com * perl/mod_perl/DBI/mysql/postgres ---------------------------------------------------------------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Awesome. Thanks. -----Original Message----- From: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Thomas Fuchs Sent: Thursday, October 19, 2006 2:48 AM To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails-spinoffs] Re: Using array.each with Element.hide 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: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Christophe > Porteneuve > Sent: Wednesday, October 18, 2006 4:34 PM > To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 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: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > > > >-- 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 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 -~----------~----~----~----~------~----~------~--~---
Hmm, interesting. Ok, I know this is a bit off topic, but can someone tell me why this is not working as I think it should? The onMouseOut activates when I move the mouse away from the link that has the onMouseOver, not when I move the mouse out from the DIV. I tested this in Firefox and IE and it does the same thing. I can do a onMouseOver the DIV as a test and it works fine. ---------------------- <script language="JavaScript" type="text/javascript"> function ShowMenu($sMenu){ var $aMenus = new Array(); $aMenus = [''submenu_reporting'', ''submenu_forms'', ''submenu_tickets'']; $aMenus.each(Element.hide) if($sMenu != '''') Element.show($sMenu); } </script> <div class="toplinks" style="width: 100%; font-size: 14px; font-weight: bold; border-bottom: 1px solid #000000; background-color: #FFFFFF; height: 50px;" onMouseOut="ShowMenu('''')"> <a href="http://sharepoint">Home</a> | <a <?php if($_SERVER[''PHP_SELF''] != ''/rm5_reporting.php'') echo ''href="/rm5_reporting.php"''?> onMouseOver="ShowMenu(''submenu_reporting'')"> RM5 Reporting</a> | <a <?php if($_SERVER[''PHP_SELF''] != ''/form_menu.php'') echo ''href="/form_menu.php"''?> onMouseOver="ShowMenu(''submenu_forms'')">Forms</a> | <a style="color: #000066" onMouseOver="ShowMenu(''submenu_tickets'')">Tickets</a> <div id="submenu_tickets" style="display: none; border-top: solid 1px black"> <a href="/admin.php?sMode=Report">Open IT Tickets</a> | <a href="/viewtickets.php">Open By User</a> | <a href="/submitticket.php?catid=1">Computer</a> | <a href="/submitticket.php?catid=2">Maintenance</a> | <a href="/submitticket.php?catid=3">Face Sheets</a> | </div> <div id="submenu_reporting" style="display: none; border-top: solid 1px black"> <a href="/rm5_reporting.php?cboReport=Daily%20Patient%20Hours">Daily Patient Hours</a> | <a href="/rm5_reporting.php?cboReport=Patient%20Info">Patient Info</a> | <a href="/rm5_reporting.php?cboReport=Patient%20Logs">Patient Logs</a> | <a href="/rm5_reporting.php?cboReport=Patients%20Due%20List">Patients Due List</a> | <a href="/rm5_reporting.php?cboReport=Phase%203">Phase 3</a> | <a href="/rm5_reporting.php?cboReport=Weekly%20Patient%20Schedule">WPS</a> </div> <div id="submenu_forms" style="display: none; border-top: solid 1px black"> <a href="/treatment_schedule.php">Treatment Schedule</a> | <a href="/form_menu.php?sForm=ccr">Concurrent Review</a> | <a href="/form_menu.php?sForm=fce">FCE</a> | <a href="/form_menu.php?sForm=mhe">MHE</a> </div> </div> ------------------------------------- _____ From: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Siegfried Puchbauer Sent: Thursday, October 19, 2006 7:56 AM To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Subject: [Rails-spinoffs] Re: Using array.each with Element.hide or that way ;) [''submenu_reports'', ''submenu_forms'', ''submenu_tickets''].map($).invoke(''hide''); cheers On 10/19/06, Thomas Fuchs <t.fuchs-moWQItti3gBl57MIdRCFDg@public.gmane.org> 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: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > [mailto:rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org] On Behalf Of Christophe > Porteneuve > Sent: Wednesday, October 18, 2006 4:34 PM > To: rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > 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: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org > > > > >-- 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 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 -~----------~----~----~----~------~----~------~--~---