Hi, and sorry for the noob question! I have an unordered list of 4 links where the links use Ajax.Updater in the onclick: onclick="new Ajax.Updater(''ajaxarea'', ''link1.php'', {asynchronous:true, evalScripts:true }); return false;" How would I go about using addClassName and removeClassName to show the current link? Thanks for any help with this. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
If you want to add a class when the request starts and remove it when it ends, then you can do $(this).addClassName(''hidden''); new Ajax.Updater(''ajaxarea'', ''link1.php'', {evalScripts: true, onComplete: function(){ this.removeClassName(''hidden'') }.bind(this)}); return false; asynchronous: true is unnecesarry, as it''s true by default. Best Nicolas On 10/24/07, SteveX <stevexi7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi, and sorry for the noob question! > > I have an unordered list of 4 links where the links use Ajax.Updater > in the onclick: > onclick="new Ajax.Updater(''ajaxarea'', ''link1.php'', {asynchronous:true, > evalScripts:true }); return false;" > > How would I go about using addClassName and removeClassName to show > the current link? > > Thanks for any help with this. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks Nicolas, I have tried with your code, but it seems to cancel the "return false", as upon clicking the url opens as the full window rather than within the targeted div. Should this work within the onclick? Steve --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Also, the className needs to be removed from the previously selected list item when a new one is selected, so that only one list item is showing as selected. Is there something that can be used in the onclick that will addClassName(''selected'') and simultaneously removeClassName(''selected'') from the other items in the list? Thanks for any further help with my question. Steve On Oct 25, 1:17 am, SteveX <steve...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks Nicolas, > > I have tried with your code, but it seems to cancel the "return > false", as upon clicking the url opens as the full window rather than > within the targeted div. Should this work within the onclick? > > Steve--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---