Key code javascript11/17/2023 Tip: If you want to find out whether the "ALT", "CTRL", "META" or "SHIFT" key was pressed when a key event occured, use the altKey, ctrlKey, metaKey or shiftKey property.This table shows the Windows scan codes representing keys and the de values which correspond to those hardware keys. The latest version of the DOM Events Specification recommend using the key property instead (if available). Note: Both the ke圜ode and which property is provided for compatibility only. Tip: If you want to convert the returned Unicode value into a character, use the fromCharCode() method. Tip: For a list of all Unicode characters, please study our Complete Unicode Reference. Solution, use the which property together with ke圜ode, e.g: Note: In Firefox, the ke圜ode property does not work on the onkeypress event (will only return 0). "F1", "CAPS LOCK" or "Home") use the onkeydown or onkeyup event. To find out if the user is pressing a function key (e.g. "a" or "5"), it is recommended to use this property on the onkeypress event. Tip: To find out if the user is pressing a printable key (e.g. These types do not always mean the same thing for example, a lower case "w" and an upper case "W" have the same keyboard code, because the key that is pressed on the keyboard is the same (just "W" = the number "87"), but a different character code because the resulting character is different (either "w" or "W", which is "119" or "87") - See "More Examples" below to better understand it. Key codes - A number which represents an actual key on the keyboard The difference between the two code types:Ĭharacter codes - A number which represents an ASCII character The ke圜ode property returns the Unicode character code of the key that triggered the onkeypress event, or the Unicode key code of the key that triggered the onkeydown or onkeyup event.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |