Ryan Gahl
2006-Mar-01 19:50 UTC
RE: manipulate <td>''s and their contentbygrabbingtheir classNames
Ahh... Haven''t run up against that yet. Although I also completely disregard Gecko/Safari and other totally crappy, useless, browsers :-). </cynicism> -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Gregory Hill Sent: Wednesday, March 01, 2006 1:47 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] manipulate <td>''s and their contentbygrabbingtheir classNames> Or... > > var myTDs = new Array(); > $A($("main").childNodes).each(function(tr) > { > $A(tr.childNodes).each(function(td) > { > myTDs.push(td); > }); > });You''ll probably want to make sure the tr elements are TR tags and the same for the td''s, as empty text nodes are inserted randomly by the gecko engine (and maybe others). Greg _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.
Ryan Gahl
2006-Mar-01 19:55 UTC
RE: manipulate <td>''s and their contentbygrabbingtheir classNames
> Object.extend(td, TDControllerClass); // added this just to show howto attach behaviors like this Sorry, should be.. Object.extend(td, TDControllerClass.prototype); The information transmitted in this electronic mail is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.
Maninder, Singh
2006-Mar-02 06:13 UTC
RE: manipulate <td>''s and their contentbygrabbingtheir classNames
Thanks for your reponses Guys, especially Ryan & troels. Like I mentioned earlier, what do you think about using the $$ function? This time I''ll take an example - $$(''table#main td.active'').each(updateClassName(elm, newClass)) Find all <td> elements with class "active", all inside the <table> with id "main" and update their class to notactive. I''ll write updateClassName myself. Let me know what you think. Thank you, Mandy.
Martin Bialasinski
2006-Mar-02 08:20 UTC
Re: manipulate <td>''s and their contentbygrabbingtheir classNames
On 3/2/06, Maninder, Singh <mandiv-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org> wrote:> Like I mentioned earlier, what do you think about using the $$ function?Troels'' code would be faster in any case. It also has constant speed, whereas> $$(''table#main td.active'').each(updateClassName(elm, newClass))grows linear with the number of td.
Possibly Parallel Threads
- RE: manipulate <td>''s and their content bygrabbingtheir classNames
- RE: manipulate <td>''s and their content by grabbingtheir classNames
- manipulate <td>''s and their content by grabbing their classNames
- RE: manipulate <td>''s andtheircontentbygrabbingtheir classNames
- RE: manipulate <td>''s and theircontentbygrabbingtheir classNames