当前位置:网站首页>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.
边栏推荐
猜你喜欢
随机推荐
Mysql索引底层数据结构
smart_rtmpd 轻松突破 C100K 测试
MATLAB中dist与pdist、pdist2的区别与联系
[Inter-process communication]: pipe communication/named/unnamed
(三)文件操作之一——文件IO
SQL在MySQL中是如何执行的
小知识点系列:数组与多维数组
FIR滤波器设计之窗函数法
DOM —— 事件代理
Xshell 使用删除键乱码问题
虚拟机使用的是此版本 VMware Workstation 不支持的硬件版本。模块“Upgrade”启动失败。未能启动虚拟机。
【软件测试】项目中关于测试人员的简单介绍
假的服务器日志(给history内容增加ip、用户等内容)
网络请求——跨域 的概念
抽象队列同步器AQS应用Lock详解
怎么使用 smart_rtmpd 的纯 webrtc 功能?
关于机组的部分知识点随笔
makefile——杂项
抽象类和接口 基本知识点复习
支付系列文章:PCI合规能力建设