The W3C DOM Level 2 Event Model specifies addEventListener as the standard way to register event handlers. For cross-browser compatibility, the following script defines addEventListener to the window object.
if (!window.addEventListener) {
window.addEventListener = function (type, listener, useCapture) {
attachEvent('on' + type, function() { listener(event) });
}
}