Prefer event.keyCode to event.which, and a few other suggested changes.