Hi Guys, I think IE is having problems recognizing when the dom is fully loaded and calling my init function before all of the elements all are the page. My code works great in Firefox but IE throws an error at this line var tabAnchors = $(navTabs).select(''li a''); saying "Error: ''null'' is null or not an object". However, if I put an alert call before that line, IE works fine. Is there a better way to check for dom load in IE? Sample code below. var NavSwitcher = { init: function(navTabs, gumballHolder) { //alert(''''); var tabAnchors = $(navTabs).select(''li a''); tabAnchors.each(function(a) { a.observe(''click'', function(e) { e.stop(); var tabName = a.readAttribute(''href''); NavSwitcher.activateTab(tabAnchors, tabName); }); }); NavSwitcher.activateScroller($(gumballHolder)); }, ..... } function video_hub_init() { NavSwitcher.init(''shows_list'', ''vid_list_holder'' ); // bypass the EOLAS patent lawsuit objects = document.getElementsByTagName("embed"); for (var i = 0; i < objects.length; i++) { objects[i].outerHTML = objects[i].outerHTML; } } document.observe("dom:loaded", video_hub_init); --~--~---------~--~----~------------~-------~--~----~ 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 May 24, 3:20 am, Chris S <granimal...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Guys, > > I think IE is having problems recognizing when the dom is fully loaded > and calling my init function before all of the elements all are the > page. My code works great in Firefox but IE throws an error at this > line var tabAnchors = $(navTabs).select(''li a''); saying "Error: ''null'' > is null or not an object". However, if I put an alert call before that > line, IE works fine. Is there a better way to check for dom load in > IE?The simplest and most robust method is to load all your scripts just before the closing body tag and call your video_hub_init() function from the last line of the last script file, or as the only code in the last script element. It avoids all issues with "dom:ready" functions and will let your page load faster too. -- 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 -~----------~----~----~----~------~----~------~--~---
Putting your scripts at the bottom of the BODY tag is one way. Prototype has some issues with IE and consistently calling the dom:loaded event. The newer 1.6.0.3 release (due out soon, I hope), should resolve this. I tweaked your code a bit: http://pastie.caboo.se/203250 - JDD --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---