jumblesale wrote:
> for (var i=1; i<=5;i++){
>     Event.observe($('star'+i), 'click',
> function(e){objRating.setRating(i)});
> }

This is because the all callbacks are accessing the same "i" variable
that is increased with each count. Perhaps something liek thsi would
work better.

5.times(function(i) {
        Event.observe('star'+i, 'click', (function(event) {
                objRating.setRating(this.id.gsub(/\D/, ''));
        }).bindAsEventListener($('star'+i));
});

Of course this is off the top of my head and not tested.

Eric


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