سؤال

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