I'd change it to

h2.addClassName('name' + (idx + 1));

because some JavaScript minimizers assume whitespace isn't significant
and would be tripped up by three plus signs in a row. (Wrapping "+
+idx" in parentheses is another way to solve that problem.)

Cheers,
Andrew

On Dec 27, 1:28 pm, chris at zeus <[EMAIL PROTECTED]> wrote:
> Fair enough.
>
> Here's what I noticed.  Since lists start with 0 and my sliced images
> (Photoshop) start with 1, I changed the code to this:
>
>         h2.addClassName('name' + ++idx)
>
> It works, but I'm curious if I'm just being lazy/hacky.
>
> Thanks for your help, btw.
>
> On Dec 25, 9:50 pm, Andrew Dupont <[EMAIL PROTECTED]> wrote:
>
> > On Dec 25, 4:27 pm, chris at zeus <[EMAIL PROTECTED]> wrote:
>
> > > You know I'm trying this, just because it is more familiar that the
> > > double dollar sign, but nothing is happening.  At least with "this" in
> > > front, I get errors. :-)
>
> > RobG has led you astray! ;)
>
> > addClassName is a method and should be invoked as such:
>
> > $(h2).addClassName('name' + i);
>
> > If you want to use the native getElementsByTagName method, you need to
> > wrap the individual nodes in $ or Element.extend before calling
> > instance methods. This is unnecessary if you use $$.
>
> > Cheers,
> > Andrew
--~--~---------~--~----~------------~-------~--~----~
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