【转载】JavaScript中的Event对象
程序员文章站
2022-06-04 15:37:50
...
Mouse / Keyboard Attributes
altKey | Returns whether or not the "ALT" key was pressed when an event was triggered | 6 | 1 | 9 | Yes |
button | Returns which mouse button was clicked when an event was triggered | 6 | 1 | 9 | Yes |
clientX | Returns the horizontal coordinate of the mouse pointer when an event was triggered | 6 | 1 | 9 | Yes |
clientY | Returns the vertical coordinate of the mouse pointer when an event was triggered | 6 | 1 | 9 | Yes |
ctrlKey | Returns whether or not the "CTRL" key was pressed when an event was triggered | 6 | 1 | 9 | Yes |
metaKey | Returns whether or not the "meta" key was pressed when an event was triggered | 6 | 1 | 9 | Yes |
relatedTarget | Returns the element related to the element that triggered the event | No | 1 | 9 | Yes |
screenX | Returns the horizontal coordinate of the mouse pointer when an event was triggered | 6 | 1 | 9 | Yes |
screenY | Returns the vertical coordinate of the mouse pointer when an event was triggered | 6 | 1 | 9 | Yes |
shiftKey | Returns whether or not the "SHIFT" key was pressed when an event was triggered | 6 | 1 | 9 | Yes |
Other Event Attributes
bubbles | Returns a Boolean value that indicates whether or not an event is a bubbling event | No | 1 | 9 | Yes |
cancelable | Returns a Boolean value that indicates whether or not an event can have its default action prevented | No | 1 | 9 | Yes |
currentTarget | Returns the element whose event listeners triggered the event | No | 1 | 9 | Yes |
eventPhase | Returns which phase of the event flow is currently being evaluated | Yes | |||
target | Returns the element that triggered the event | No | 1 | 9 | Yes |
timeStamp | Returns the time stamp, in milliseconds, from the epoch (system start or event trigger) | No | 1 | 9 | Yes |
type | Returns the name of the event | 6 | 1 | 9 | Yes |
摘自:http://www.w3schools.com/jsref/dom_obj_event.asp
注:本博客文章均已注明原创和转载,如转载本博客文章,需注明原文出处或征求原作者同意。