Dia wrote:
> ...
> Event.observe(window, 'load', function() {
> var jeux = $('listeJeux').getElementsByTagName('li');
> for (i = 0; i < jeux.length; i++) {
> Event.observe(jeux.item(i), 'click', function(event) {
> alert(Event.element(event).getAttribute('class'));
> });
> }
> });
> ...
> with Firefox, no problem, the alert shows correct values
> with IE, the alert says "null"
> ...
I don't believe the Event.element() automatically extends the element so
you need $(Event.element(event)).getAttribute('class')
Also, try shortening your code using $$() and invoke()--example below.
- Ken
Event.observe(window, 'load', function() {
$$('#listeJeux li).invoke('observe', 'click', function(event) {
alert($(Event.element(event)).getAttribute('class'));
});
});
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---