This seems to work in Firefox and Safari without issue. What would be the reason IE7 doesn''t like it (Object expected)? <a href="#" class="off" onClick="toggleClassName(''on''); return false; ">Click to toggle</a> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
chris at zeus a écrit :> This seems to work in Firefox and Safari without issue. What would be > the reason IE7 doesn''t like it (Object expected)? > > <a href="#" class="off" onClick="toggleClassName(''on''); return false; > ">Click to toggle</a>I suspect inline handlers don''t have the same binding in IE7 as they do in FF/Saf. Try this: ...onclick="Element.toggleClassName(this, ''on''); return false;">... -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 28, 5:45 am, chris at zeus <c...-IPdWn+TdYYTuufBYgWm87A@public.gmane.org> wrote:> This seems to work in Firefox and Safari without issue. What would be > the reason IE7 doesn''t like it (Object expected)? > > <a href="#" class="off" onClick="toggleClassName(''on''); return false; > ">Click to toggle</a>For browsers that support DOM element extensions (Firefox, Safari, et al), Prototype.js extends the base DOM element object, so all element methods are available directly from the element. IE doesn''t support element extensions, however you can ask Prototype.js to extend individual elements using the $() function. So, you can use Christophe''s suggestion to call the Element.toggleClassName method directly, or use the handler''s this keyword to get an element reference, extend it with $() and then call the method: <a ... onclick="$(this).toggleClassName(''on''); return false;"...> -- Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---