AddEventListener with mouse events -MouseEvent usage (rpm)

altkey: whether the alt key has been pressed the trigger mouse events, if pressed, it returns true, otherwise returns fasle.

button: Events property returns an Arabic numeral, press 0 for left, 1 for press rollers, 2 for the right button.

offsetX, offsetY: Event property returns the mouse event source with respect to the element X, Y coordinates, no standard event attributes corresponding trigger event.

clientX, clientY: event property is triggered when the event returns to the mouse pointer relative to the browser page (or client area) of the horizontal coordinate, vertical coordinate.

pageX, pageY: Event property returns the event is triggered when the mouse pointer with respect to the upper left corner of the entire page horizontal coordinate, vertical coordinate.

screenX, screenY: Event property returns the mouse position coordinates relative to the water level of the user's screen when an event is triggered, vertical coordinate, when the reference point is the top left corner is the origin.

Well, narrative is always a pain, the classic chart explaining everything:

https://www.cnblogs.com/hanguozhi/p/7382719.html

addEventListener usage

Event type
event type on the whole can be divided into three categories:

1) a mouse-type
click click

mousedown Press

mouseup release

mouseenter paddled

mouseleave draw

mouseover paddled

mouseout draw

Mobile mousemove

The above two paddled draw, the difference is whether the sub-elements affect the specific differences Baidu can go look it up usage

 

2) Keyboard class
keydown press (press all the keys will be triggered)

keypress Press (press character set trigger)

keyup release

Both originally designed differently.

keypress is used to detect what the user inputs the character, it is a simple and keydown detecting whether the user pressed a key on the keyboard, the keypress used.

keyCode value on both event objects are also different.

keyCode is a code with a key on the keyboard corresponds. In keypress event, this also corresponds to the ASCII code keyCode, such keyCode equal to 105, is press i.

Finally he said, do not judge a front-end professional professional, he asked his development of the interface when there is no thought about keyboard events.
----------------
Disclaimer: This article is CSDN blogger "Wan sheep" of the original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source and this link statement.
Original link: https: //blog.csdn.net/allenyhy/article/details/82906751

 

Well, pay attention to the next keyboard event

Guess you like

Origin www.cnblogs.com/guopeng112/p/12663916.html