Home > Web Front-end > JS Tutorial > Introduction to the use of window.event.keyCode in Javascript_javascript skills

Introduction to the use of window.event.keyCode in Javascript_javascript skills

WBOY
Release: 2016-05-16 18:07:19
Original
1142 people have browsed it

The main purpose is to monitor which key is pressed on the keyboard and convert it into ASCII code;

Copy the code The code is as follows:





window.event.keyCode






So how to use carriage return to replace the carriage return on the numeric keyboard? First of all, we need to know that the ASCII code of the carriage return is 13 and the ASCII code of the TAB key is 9, then it is easy to handle;
Copy code The code is as follows:





Use Enter instead of TAB key







In the above code we used keyCode is used to implement Enter instead of the TAB key. It just makes a simple judgment. If the Enter (13) is pressed, we assign the value of TAB (9) to it (to deceive the computer). These small The accumulation of details is also a lot of wealth!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template