addEventListener registers a single event listener on a single target. The event target may be a single node in a document, the document itself, a window, or an XMLHttpRequest.
In IE you have to use attachEvent rather than the standard addEventListener.
if (window.addEventListener) { // Mozilla, Netscape, Firefox el.addEventListener('onclick', function, false ); } else { // IE el.attachEvent('onclick', function); } |