The console.log return this which looks like and array : keyup charCode=0, keyCode=18 But I tried event[1] to get the keycode but it's undefined, how do I extract the keycode from this ?

function processKeyDown(event)
{
    console.log(event);
}
有帮助吗?

解决方案

this is because event is an object, not an indexed based array. use event.keyCode instead.

其他提示

Use event.keyCode to access the key that was pressed.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top