h2 seems like an odd tag choice. I'd think a ul/li combo would be
preferred, but that doesn't matter.

How about this...

$$('#vertical_container h2').each(function(h2, idx)
{h2.addClassName('name'+idx)})

On 12/22/07, chris at zeus <[EMAIL PROTECTED]> wrote:
>
> I'm working with stickman's accordion script. and it works great, but
> I'm trying to add some additional class names my list within the
> accordion.
>
> For example:
>
> <div id="vertical_container">
>         <h2 class="accordion_toggle">First Name</h2>
>         <h2 class="accordion_toggle">Second Name</h2>
>         <h2 class="accordion_toggle">Third Name</h2>
> </div>
>
> I'd like it to be this:
>
> <div id="vertical_container">
>         <h2 class="accordion_toggle name1">First Name</h2>
>         <h2 class="accordion_toggle name2">Second Name</h2>
>         <h2 class="accordion_toggle name3">Third Name</h2>
> </div>
>
>
> I cold set this manually to include an individual class for each one,
> but I would rather have this done in Javascript.
>
> function Names() {
>          var mylist = document.getElementById('vertical_container');
>          var h2 = mylist.getElementsByTagName('h2');
>
>          for (var i = 0; i < h2.length; i++) {
>                  this.h2.addClassName = 'name' + i;
>         }
> }
>
> But firebug is telling me, "this.h2 has no properties"
>
> What would be really great is if I could also change these classes in
> the accordion script too.  Baby steps though.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to