The following line causes trouble both with IE 6&7: cels[i].toggle(); It tells me that this element does not support the property or method. The element is a cell (TD) which I checked by outputting the tagName and it works with FF, Opera and Safari. The IE script debugger stops at this line but I didn''t find a single posting on the net with a similar problem which is kind of strange. Is there any known issue with toggling a table cell in IE? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Forgot to post the entire function: function toggleCells() { var tbl = $(''master''); var rows = tbl.getElementsByTagName(''tr''); for(var i=1; i<5; i++) { for (var row=0; row<rows.length;row++) { if(rows[row].className != ''index'') { var cels = rows[row].getElementsByTagName(''td''); cels[i].toggle(); } } } } --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I just ran another test on a basic page: <html> <head> <script language=''JavaScript'' src=''prototype.js''></script> <script> function change2() { $(''cell'').toggle(); } function change() { var tbl = $(''test''); var rows = tbl.getElementsByTagName(''tr''); var cells = rows[0].getElementsByTagName(''td''); cells[0].toggle(); } </script> </head> <body> <table id="test"> <tr><td id="cell">This is weird.</td></tr> </table> <input type="button" onClick="change()" value="Button 1" /> <input type="button" onClick="change2()" value="Button 2" /> </body> </html> When I click button 1 I get the error. Button 2 works. However when I click button 1 after having toggled with button 2 before it even works with button 1. Is there something I can do about it? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
$(cells[0]).toggle(); should do the trick. That''s because "getElementsByTagName" returns NodeList of unextended elements [1] You could also use $$(''#test tr:first-child td:first-child'') - that should give the same result Best, kangax [1] http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-1938918D On Mar 25, 10:34 am, CO2 <xml.transforma...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> I just ran another test on a basic page: > > <html> > <head> > <script language=''JavaScript'' src=''prototype.js''></script> > <script> > function change2() > { > $(''cell'').toggle(); > } > > function change() > { > var tbl = $(''test''); > var rows = tbl.getElementsByTagName(''tr''); > var cells = rows[0].getElementsByTagName(''td''); > cells[0].toggle(); > } > </script> > </head> > <body> > <table id="test"> > <tr><td id="cell">This is weird.</td></tr> > </table> > <input type="button" onClick="change()" value="Button 1" /> > <input type="button" onClick="change2()" value="Button 2" /> > </body> > </html> > > When I click button 1 I get the error. Button 2 works. However when I > click button 1 after having toggled with button 2 before it even works > with button 1. > Is there something I can do about it?--~--~---------~--~----~------------~-------~--~----~ 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 Mar 26, 12:04 am, CO2 <xml.transforma...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> Forgot to post the entire function: > > function toggleCells() > { > var tbl = $(''master''); > var rows = tbl.getElementsByTagName(''tr'');Table elements have a rows property that is a collection of the table''s rows, so: var rows = tbl.rows; <URL: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-6156016 >> for(var i=1; i<5; i++) > { > for (var row=0; row<rows.length;row++) { > if(rows[row].className != ''index'') > { > var cels = rows[row].getElementsByTagName(''td'');Table rows have a cells property that is a collection of all the cells in a row: var cells = rows[row].cells; <URL: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-67349879 >> cels[i].toggle();Since you want an extended cell, then perhaps: $(cells[i]).toggle(); -- 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 -~----------~----~----~----~------~----~------~--~---
Apparently Analagous Threads
- RE: manipulate <td>''s and their content bygrabbingtheir classNames
- Add to enumerable
- rjs error TypeError: element.getElementsByTagName is not a function in rails 3+jquery
- Marginal Effects of continuous variable in lrm model (Design package)
- RcppArmadillo compilation error: R CMD SHLIB returns status 1