The W3C DOM Level 2 Event Model specifies addEventListener as the standard way to register event handlers but IE doesn’t support addEventListener. Instead IE provides an alternative attachEvent method for that purpose.
It does exactly the same thing but Microsoft decided to create their own method for the same purpose.
An example is given below shows how to provide cross browser compatibility for addEventListener:
Please feel free to post other alternatives, if you know.