Skip to main content

Ivan Teoh

Something personal yet public

174-homework3.js

(Source)

1
2
3
4
5
6
7
function registerEventHandler(node, eventType, handler) {
    if (typeof node.attachEvent === 'function') {
        node.attachEvent("on" + eventType, handler);
    } else {
        node.addEventListener(eventType, handler, false);
    }
}