Created
January 29, 2013 19:22
-
-
Save Beneboe/4666855 to your computer and use it in GitHub Desktop.
comes in handy when working with html5 canvas
This file contains hidden or 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
var keyPressed; | |
document.onkeyup = function(event) { | |
keyPressed = String.fromCharCode(('which' in event) ? event.which : event.keyCode); | |
input(); | |
}; | |
function input() { | |
if(keyPressed == "D") document.write("hi"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment