当前位置:网站首页>事件对象的说明》
事件对象的说明》
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>
边栏推荐
- 9.缓存优化
- Thrift easy to use
- MySQL knowledge summary (useful for thieves)
- Enterprise data center "cloud" transformation solution
- 基于Svelte3.x桌面端UI组件库Svelte UI
- Distributed things
- qmlplugindump executable not found. It is required to generate the qmltypes file for VTK Qml
- [ubuntu-mysql 8 installation and master-slave replication]
- Plan the IT technology route for the new year? Let's learn about Gartner infrastructure hype cycle
- JVM family
猜你喜欢
Installing Oracle database process in windows2007 on VM
仿照微信Oauth2.0接入方案
【JVM】G1垃圾回收器简述
How to build a private cloud and create a hybrid cloud ecosystem?
Recommend a very easy-to-use network communication framework HP socket
MySQL optimization
Financial private cloud infrastructure scheme evaluation (Architecture and storage)
训练一个图像分类器demo in PyTorch【学习笔记】
Machine learning note 9: prediction model optimization (to prevent under fitting and over fitting problems)
CRF (conditional random field) learning summary
随机推荐
Create thread pool demo
Eight sorts (I)
Pytorch graduate warm LR installation
Shenhe thermomagnetic: Super fusion dual active cluster solution for MES system
Utlis memory pool object pool
八大排序(一)
Task summary in NLP
Returnjson, which allows more custom data or class names to be returned
ABAP time function
Redis docker 主从模式与哨兵sentinel
Techtarget: Interpretation of the basic concept of super fusion cloud
Network based dynamic routing protocol (OSPF)
Add / delete query of topic
Recommend a very easy-to-use network communication framework HP socket
【新书推荐】Cleaning Data for Effective Data Science
2021-07-26
Slf4j: failed to load class "org.slf4j.impl.staticloggerbinder"
Eight sorts (II)
【新书推荐】Deno Web Development
安装和使用