当前位置:网站首页>DOM - Event Object
DOM - Event Object
2022-08-02 16:33:00 【z_Xiao Zhang classmate】
Event Object:
If given an event of an element object (such as onclick) binds a response function (callback function), which is called by the browser when the event is triggered.and browsercreates an object to describe this event.
When the event is triggered, the handler function will pass in data - the information when it is triggered.
When the mouse event fires:
altKey When the mouse event occurs, whether to press the alt key, return a boolean
ctrlKey When the mouse event occurs, whether to press the ctrl key, return a boolean
metaKey When the mouse event occurs, whether to press the windows/commond key, return a boolean
shiftKey When the mouse event occurs, whether to press the shift key, return a boolean
pageX The X coordinate of the mouse click; (including the body hidden)
pageY The Y coordinate of the mouse click;(including body hidden)
clientX clientY returns the coordinates of the mouse position relative to the upper left corner of the browser window, in pixels (excluding body hidden)
screenX screenY returns the coordinates of the mouse position relative to the upper left corner of the screen,The unit is pixel
movementX, movementY returns a displacement value, the unit is pixel, indicating the distance between the current position and the last mousemove event
offsetX/offsetY is relative to the element's own x/y and whether it is positionedElement independent
When the keyboard event fires:
charCode/keyCode key code value key key code (left 37, top 38, right 39, bottom 40, enter 13)
This in the event points to:
1. Inline: When inline binding, the inline environment object is btn The caller of the function is window and the event object cannot be obtained.
2. Element attributes: this points to the dom element itself, and the event object is in the parameter.
3.addEventListener: this points to the dom element itself, and the event object is in the parameter.
边栏推荐
猜你喜欢
随机推荐
adb常用命令
【频域分析】频谱泄露、频率分辨率、栅栏效应
golang中使用泛型
(三)文件操作之一——文件IO
flask获取post请求参数
解决跨域问题的方法 --- JSONP
nodejs 的下载安装与环境配置
【面经】被虐了之后,我翻烂了equals源码,总结如下
GC垃圾收集器G1
Template series-union set
Three-way joint interface data security issues
RTMP, RTSP, SRT 推流和拉流那些事
二、QT界面开发--新建C语言工程
支付系列文章:PCI合规能力建设
排列熵、模糊熵、近似熵、样本熵的原理及MATLAB实现之近似熵
JVM常量池详解
个人成长系列:好问题清单
filebeat的配置
移动端UI自动化相关环境配置
Oauth2.0 Supplement