In Mozilla:
How to use AddEventListener:
Target.addeventlistener (type, listener, usecapture);
Target: Documentation node, document, window, or XMLHttpRequest.
Type: String, event name, without "on", such as "click", "MouseOver", "KeyDown" and so on.
Listener: Implements a EventListener interface or a function in JavaScript.
Usecapture: Whether to use snapping, generally with false. For example: document.getElementById ("Testtext"). AddEventListener ("KeyDown", function (event) {alert (event.keycode);}, False );
In IE:
Target.attachevent (type, listener);
Target: Documentation node, document, window, or XMLHttpRequest.
Type: String, event name, including "on", such as "onclick", "onmouseover", "onkeydown" and so on.
Listener: Implements a EventListener interface or a function in JavaScript. For example: document.getElementById ("TXT"). attachevent ("onclick", function (event) {alert (event.keycode);});
Compatible wording:
if (window.attachevent) { obj.attachevent (function() {alert (even.innerhtml)}); ie } else { obj.addeventlistener (function false// Firefox }
JavaScript on attachevent and addeventlistener differences and compatibility notation