Problem with prototype Event class and IE

Tim Bellinghausen
Wed, 09 Aug 2006 12:38:23 -0000

Hi *,

I have a problem with the prototype Event class and the Internet
Explorer. The page is just some positioned divs and a p for debugging
output. (It is used just for understanding some other IE difficulties)
The javascript code used is the following:

   function show_clicked(event) {
      $(''DEBUG'').innerHTML += Event.element(event).id+"
clicked ";
   }

   Behaviour.register({
      ''div'': function(element) { element.onclick =
show_clicked }
   });

Everything is fine in Firefox, but if I try this in IE it gives an
error, when clicking on any div. The error message is
"''target'' is null
or not an object" and refers to the following line in  prototype.js;

  element: function(event) {
    return event.target || event.srcElement;
  },

Inside the Event class. Has anybody a solution to this problem or at
least an explanation, why this happens.

Greets, Tim