Appendix A. Keyboard Event Character Values

Keyboard events in recent browsers provide information about the keys and, where applicable, about the characters corresponding to the keys. Character values may be read from the onkeypress event. The following table reveals the codes for characters in the lower ASCII character set. Some of these codes are for action keys (such as Backspace and Tab), whose character values are also in this range:

Character

Value

Character

Value

Backspace

8

0

48

Tab

9

1

49

Enter (Return on Mac)

13

2

50

Space

32

3

51

!

33

4

52

"

34

5

53

#

35

6

54

$

36

7

55

%

37

8

56

&

38

9

57

'

39

:

58

(

40

;

59

)

41

<

60

*

42

=

61

+

43

>

62

,

44

?

63

-

45

@

64

.

46

A

65

/

47

B

66

C

67

h

104

D

68

i

105

E

69

j

106

F

70

k

107

G

71

l

108

H

72

m

109

I

73

n

110

J

74

o

111

K

75

p

112

L

76

q

113

M

77

r

114

N

78

s

115

O

79

t

116

P

80

u

117

Q

81

v

118

R

82

w

119

S

83

x

120

T

84

y

121

U

85

z

122

V

86

{

123

W

87

|

124

X

88

}

125

Y

89

~

126

Z

90

Delete

127

[

91

\

92

]

93

^

94

_

95

`

96

a

97

b

98

c

99

d

100

e

101

f

102

g

103

Get JavaScript & DHTML Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.