[EMAIL PROTECTED] a écrit :
> Okay.. i got it.
> 
> document.getElementById insted of the the "imgId" works. No idea why it
> is not perfoming this by iteself within the onComplete Handler.

a) Welcome to the wonderful world of JS scoping.  The trouble with your
former code was, item is a *reference*, that got used by *all* observe
calls in your loop, therefore *all* observations were on the latest item
you looped over (didn't try, but it's a common issue, so this is the
likely cause).

b) Cut that down by using the $ function instead of document.getElementById:

        Event.observe($(item.ImgId), ...);

More Prototypish :-)

'HTH

-- 
Christophe Porteneuve a.k.a. TDD
"[They] did not know it was impossible, so they did it." --Mark Twain
Email: [EMAIL PROTECTED]

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

Reply via email to