Indeed, both standard and legacy IE event handlers are supported:
// standard
clickElem.addEventListener("click", function(evt) {
}, false);
// legacy IE
clickElem.attachEvent("onclick", function(evt) {
});
It is common practice to create helper functions to simplify the use of cross-browser event handlers.
function addEvent(elem, eventName, fn) {
if (typeof addEventListener !== "undefined") {
elem.addEventListener(eventName, fn, false);
} else {
elem.attachEvent("on" + eventName, fn);
}
}
// usage example
addEvent(clickElem, "click", function(evt) {
alert("You clicked me.");
});
If you decide not to utilize Prototype, you will need to manage the differences between the two event models independently. Alternatively, if you opt for another library or framework, it's advisable to follow that specific API.