function leftArrowPressed() {
// Your stuff here
}
function rightArrowPressed() {
// Your stuff here
}
document.onkeydown = function(evt) {
evt = evt || window.event;
switch (evt.keyCode) {
case 37:
leftArrowPressed();
break;
case 39:
rightArrowPressed();
break;
}
};