Home > Web Front-end > JS Tutorial > js binding keyboard and mouse events sample code_javascript skills

js binding keyboard and mouse events sample code_javascript skills

WBOY
Release: 2016-05-16 17:00:28
Original
1348 people have browsed it

1. Bind the keyboard Enter event (Note: When submitting with jq, you can submit by pressing the Enter key at the same time. Do not use form at this time.)

Copy code The code is as follows:

document.onkeydown = function(evt){
var evt = window.event?window.event:evt;
if (evt.keyCode==13){
subcomment(); //If the Enter key is pressed, the corresponding js function is executed
}
}
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