home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Dynamic HTML: The Definitive Reference, 2rd Ed.Dynamic HTML: The Definitive ReferenceSearch this book

Appendix C. Keyboard Event Character Values

Keyboard events in recent browsers provide information about the keys and, where applicable, characters corresponding to the keys. Character values may be read from the onkeypress event, while the key values, including navigation and function keys, are available from onkeydown and onkeyup events. The event object properties you use to read these values varies with the event object model. See Chapter 6 for cross-browser implementation details.

The following table reveals the codes for characters in the lower ASCII character set. Some of the codes are for action keys (such as Backspace and Tab), which have character values that are also in this range. Read these values from an onkeypress event object.

Character

Character Value

Backspace

8

Tab

9

Enter (Return on Mac)

13

Space

32

!

33

"

34

#

35

$

36

%

37

&

38

`

39

(

40

)

41

*

42

+

43

,

44

-

45

.

46

/

47

0

48

1

49

2

50

3

51

4

52

5

53

6

54

7

55

8

56

9

57

:

58

;

59

<

60

=

61

>

62

?

63

@

64

A

65

B

66

C

67

D

68

E

69

F

70

G

71

H

72

I

73

J

74

K

75

L

76

M

77

N

78

O

79

P

80

Q

81

R

82

S

83

T

84

U

85

V

86

W

87

X

88

Y

89

Z

90

[

91

\

92

]

93

^

94

_

95

`

96

a

97

b

98

c

99

d

100

e

101

f

102

g

103

h

104

i

105

j

106

k

107

l

108

m

109

n

110

o

111

p

112

q

113

r

114

s

115

t

116

u

117

v

118

w

119

x

120

y

121

z

122

{

123

|

124

}

125

~

126

Delete

127

The following table lists all keys on a typical U. S. English keyboard and their corresponding key codes. Read these codes from an onkeydown or onkeyup event object:

Key

Key Value

Alt

18

Arrow Down

40

Arrow Left

37

Arrow Right

39

Arrow Up

38

Backspace

8

Caps Lock

20

Ctrl

17

Delete

46

End

35

Enter

13

Esc

27

F1

112

F2

113

F3

114

F4

115

F5

116

F6

117

F7

118

F8

119

F9

120

F10

121

F11

122

F12

123

Home

36

Insert

45

Num Lock

144

(NumPad) -

109

(NumPad) *

106

(NumPad) .

110

(NumPad) /

111

(NumPad) +

107

(NumPad) 0

96

(NumPad) 1

97

(NumPad) 2

98

(NumPad) 3

99

(NumPad) 4

100

(NumPad) 5

101

(NumPad) 6

102

(NumPad) 7

103

(NumPad) 8

104

(NumPad) 9

105

Page Down

34

Page Up

33

Pause

19

Print Scrn

44

Scroll Lock

145

Shift

16

Spacebar

32

Tab

9

A

65

B

66

C

67

D

68

E

69

F

70

G

71

H

72

I

73

J

74

K

75

L

76

M

77

N

78

O

79

P

80

Q

81

R

82

S

83

T

84

U

85

V

86

W

87

X

88

Y

89

Z

90

1

49

2

50

3

51

4

52

5

53

6

54

7

55

8

56

9

57

0

48

`

222

-

189

,

188

.

190

/

191

;

186

[

219

\

220

]

221

`

192

=

187



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.