当前位置:网站首页>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.
![]()
边栏推荐
猜你喜欢
随机推荐
华为单臂路由配置,实现不同vlan之间的通信
【web渗透】文件包含漏洞入门级超详细讲解
解决跨域问题的方法 --- CORS
DOM —— 事件绑定与解绑
Nvm,Nrm使用教程
nodejs 的下载安装与环境配置
2021年华为杯数学建模竞赛E题——信号干扰下的超宽带(UWB)精确定位问题
Mysql锁机制与事务隔离
【路由器与交换机的作用与特点 】
Vmware workstation16 安装 ESXi 6.7 详细步骤
test3
makefile——rule概览
RTMP, RTSP, SRT 推流和拉流那些事
Template Series - Dichotomous
虚拟机使用的是此版本 VMware Workstation 不支持的硬件版本。模块“Upgrade”启动失败。未能启动虚拟机。
web渗透之文件上传漏洞
abstract和接口的基础知识
网络运维系列:GoDaddy Shell DDNS配置
华为Vlan创建及原理简单说明
[Inter-process communication]: pipe communication/named/unnamed









