A cross-browser keyboard event handler, written in JavaScript