Created
March 14, 2014 08:04
2048 - random arrow play
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
function fireKey() | |
{ | |
if(document.createEventObject) | |
{ | |
var eventObj = document.createEventObject(); | |
eventObj.keyCode = Math.floor(Math.random() * (40 - 37 + 1)) + 37; | |
document.fireEvent("onkeydown", eventObj); | |
}else if(document.createEvent) | |
{ | |
var eventObj = document.createEvent("Events"); | |
eventObj.initEvent("keydown", true, true); | |
eventObj.which = Math.floor(Math.random() * (40 - 37 + 1)) + 37; | |
document.dispatchEvent(eventObj); | |
} | |
} | |
setInterval(fireKey, 200); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment