문제

i want to know how to get the ascii code for the combination of keys. Like i want to handle event for some unique key combination [alt+ctrl+shift]. Alternatively can you please tell me the ascii code for [alt+Enter], [ctrl+Enter].

도움이 되었습니까?

해결책

There are flags on the event object that tell you if the alt, control or shift keys have been entered:

if (event.shiftKey) {}
if (event.altKey) {}
if (event.ctrlKey) {}

To get the key code (e.g. space), you need to check the event.keycode (13 will get you enter)

if (event.keyCode === 13){}

다른 팁

There aren't really standard mappings from keyboard codes to ASCII. Maybe this PC keyboard scan code table will help.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top