当前位置:网站首页>事件对象的说明》
事件对象的说明》
2022-06-30 09:35:00 【zimingyo】
事件对象
获取事件对象
事件对象:也是个对象,这个对象里有事件触发时的相关信息
事件对象的位置:在事件绑定的回调函数的第一个参数就是事件对象
元素.addEventListener('click',function(e){
})
事件对象常用属性
部分常用属性
- type 获取当前的事件类型
- clientX/clientY 获取光标相对于浏览器可见窗口左上角的位置
- offsetX/offsetY 获取光标相对于当前DOM元素左上角的位置
- key 用户按下的键盘键的值;现在不提倡使用keyCode
- pageX/pageY 相当于页面窗口
<body>
<script> document.addEventListener('click',function(e) {
console.log(e.type) console.log(e.clientX,e.clientY) console.log(e.offsetX,e.offsetY) console.log(e.pageX,e.pageY) }) </script>
</body>
边栏推荐
- Object detection yolov5 open source project debugging
- Application exploration and practice of super convergence in the production environment of insurance industry
- Redis docker master-slave mode and sentinel
- GPT (improving language understanding generative pre training) paper notes
- About the smart platform solution for business hall Terminal Desktop System
- DDD interview
- MySQL explain
- Upgrade log4j2 to 2.17.1 stepped pit
- 目标检测yolov5开源项目调试
- 2021-11-15
猜你喜欢

MySQL优化

How to build an all-in-one database cloud machine that meets the needs of information innovation?

近期学习遇到的比较问题

Object detection yolov5 open source project debugging

How do databases go to the enterprise cloud? Click to view the answer

P. Summary of NP, NPC, NP hard and other issues

【新书推荐】MongoDB Performance Tuning

云技能提升好伙伴,亚马逊云师兄今天正式营业

Design of mfc+mysql document data management system based on VS2010

prometheus 监控之 ntp_exporter
随机推荐
JWT expiration processing - single token scheme
Dart 开发技巧
GPT (improving language understanding generative pre training) paper notes
tf. keras. layers. Attention understanding summary
基于Svelte3.x桌面端UI组件库Svelte UI
IDC released the report on China's software defined storage and hyper convergence market in the fourth quarter of 2020, and smartx hyper convergence software ranked first in the financial industry
Thrift easy to use
Recommend a very easy-to-use network communication framework HP socket
抽象类和接口
Mysql database learning 1
【JVM】G1垃圾回收器简述
Upgrade log4j2 to 2.17.1 stepped pit
Based on svelte3 X desktop UI component library svelte UI
Techtarget: Interpretation of the basic concept of super fusion cloud
JVM tuning tool introduction and constant pool explanation
[new book recommendation] mongodb performance tuning
Datatabletomodellist entity class
Machine learning note 9: prediction model optimization (to prevent under fitting and over fitting problems)
NTP of Prometheus monitoring_ exporter
Returnjson, which allows more custom data or class names to be returned