I have a little script to do expand-o headers within a single div:
Event.observe(window,'load',function(){
var headers = $('test').getElementsBySelector('h3');
for (var i = headers.length - 1; i >= 0; i--){
headers[i].addClassName('fakelink');
headers[i].next('div').hide();
headers[i].observe('click',function(e){
this.next('div').toggle();
}.bind(headers[i]));
};
});
I count at least three too many headers[i] in the above, and I'm
wondering if someone could take a moment to show me the cool-kids way
to do the same thing. I am guessing it is probably some one-word magic
like 'each' or something like that...
Thanks,
Walter
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---