Monthly Archives: March 2012

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!

Posted in Javascript / HTML / CSS | Leave a comment