function setup() { document.getElementById('canvas').addEventListener('mousemove',onMouseMove); document.getElementById('canvas').addEventListener('keydown',onKeyDown); } function onMouseMove(event) { var posx = event.clientX; var posy = event.clientY; console.log("(", posx, ", ", posy, ")"); } function onKeyDown(event) { var keyID = event.keyID; console.log("ID: ", keyID); }