This example describes the JS mouse button events and keyboard key event usage. Share to everyone for your reference, specific as follows:
Keydown,keyup,keypress: A keyboard key that belongs to you
Mousedown,mouseup: The mouse button that belongs to you
The KeyDown event occurs when the button is pressed.
The KeyUp is triggered when the user lifts the button.
The complete key press process is divided into two parts: 1. The key is pressed; 2. The key is loosened.
When the user presses the mouse button on this element, the MouseDown occurs
Occurs when the user releases the mouse button over this element MouseUp
Example
1. Which button of the mouse is clicked
2. What is the cursor coordinates of the current mouse?
3. What is the Unicode code that presses the key?
4. What are the coordinates of the current mouse cursor relative to the screen?
5. What is the cursor coordinates of the current mouse?
6. The SHIFT key is pressed
7. Which element is currently clicked
alert ("You clicked" + Tname + "element")
}
</script>
PS: Here again for you to provide a JS event on the online tool, summed up the JS commonly used event types and function functions:
JavaScript event and Feature description encyclopedia:
Http://tools.jb51.net/table/javascript_event
More readers interested in JavaScript-related content can view the site topics: "JavaScript window operations and tips summary", "javascript json operation tips Summary", "JavaScript switching effects and techniques summary", " JavaScript Search Algorithm Skills Summary, "JavaScript animation effects and techniques Summary", "JavaScript Error and debugging skills Summary", "JavaScript data structure and algorithm skills summary", "JavaScript traversal algorithm and skills summary" and The summary of JavaScript mathematical operational usage
I hope this article will help you with JavaScript programming.