Created
June 27, 2014 17:33
-
-
Save ruthenium/ab9bae61df2e89d60794 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////// | |
////ATTACH EVENT LISTENER | |
///////////////// | |
function attachEventListener(eventTarget, eventType, eventHandler) { | |
if (eventTarget.addEventListener) { | |
eventTarget.addEventListener(eventType, eventHandler, false); | |
} else if (eventTarget.attachEvent) { | |
eventType = "on" + eventType; | |
eventTarget.attachEvent(eventType, eventHandler); | |
} else { | |
eventTarget["on" + eventType] = eventHandler; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment