Added support for more browsers

Now works with event.which or event.keyCode, so browsers that only have
event.keyCode can still use it.