IE: Event in onClick-Handler

When I normally register an onClick handler in Firefox or Chrome, the first argument will contain the event itself, but what about our old friend IE? This one won’t get any arguments and I wondered how I could access the event to figure out what kind of event it exactly was … and which target had been hit.

In IE there’s a global variable called ‘event’ which can be accessed and contains all the data we want to have. So in your code you probably need something like:

to make it work in all browsers!

This entry was posted in Javascript / HTML / CSS. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


8 + = fifteen

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">