Keyboard ASCII code Query

Source: Internet
Author: User

Keyboard ASCII code Query

You can consider the ASCII code of F1 -- F12 in this way.

The ASCII code of F1 is: 112, and then the ASCII code table of F2 -- F12 is obtained in turn.

Example:

Function document. onkeydown ()
{
If (event. keycode = '68 ')
{
Alert ('the d key you entered on the keyboard ');
}
}

 

Function document. onkeypress ()
{
If (event. keycode = '43 ')
{
Alert ('+ "key you have entered the keyboard ');
}
}

JS shield combinationFunction key

Blocked key combination Ctrl + n

<Script language =Javascript>
Function keydown (){
If (window. event. altkey )&&
(Window. event. keycode = 37) | // mask Alt + direction key seek
(Window. event. keycode = 39) {// mask Alt + direction key →
Alert ("You are not allowed to use Alt + arrow keys to move forward or backward the webpage! ");
Event. returnvalue = false;
}
If (event. keycode = 8) | // shield the unregeed deletion key
(Event. keycode = 116) {// block the F5 refresh key
Event. keycode = 0;
Event. returnvalue = false;
}
If (event. ctrlkey) & (event. keycode = 78) {// block Ctrl + n
Event. returnvalue = false;
}
If (event. shiftkey) & (event. keycode = 121) {// block SHIFT + F10
Event. returnvalue = false;
}
If (event. keycode = 122) {// block F11
Event. returnvalue = false;
}
}

ASC code

 

ASCII code Keyboard ASCII code Keyboard ASCII code Keyboard ASCII code Keyboard
27 ESC 32 Space 33 ! 34 "
35 # 36 $ 37 % 38 &
39 ' 40 ( 41 ) 42 *
43 + 44 ' 45 - 46 .
47 / 48 0 49 1 50 2
51 3 52 4 53 5 54 6
55 7 56 8 57 9 58 :
59 ; 60 < 61 = 62 >
63 ? 64 @ 65 A 66 B
67 C 68 D 69 E 70 F
71 G 72 H 73 I 74 J
75 K 76 L 77 M 78 N
79 O 80 P 81 Q 82 R
83 S 84 T 85 U 86 V
87 W 88 X 89 Y 90 Z
91 [ 92 / 93 ] 94 ^
95 _ 96 ` 97 A 98 B
99 C 100 D 101 E 102 F
103 G 104 H 105 I 106 J
107 K 108 L 109 M 110 N
111 O 112 P 113 Q 114 R
115 S 116 T 117 U 118 V
119 W 120 X 121 Y 122 Z
123 { 124 | 125 } 126 ~

 

Example:

Function document. onkeydown ()
{
If (event. keycode = '68 ')
{
Alert ('the d key you entered on the keyboard ');
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.