我想用js获取鼠标位置,按网上的说法:
window.event.clientX
结果报错如下
Uncaught TypeError: Cannot read properties of undefined (reading 'clientX')
at draw (index.html:136:49)
at animloop (index.html:154:13)
请问是缺了什么吗,我是用的原生js,该如何获取鼠标位置呢?
我想用js获取鼠标位置,按网上的说法:
window.event.clientX
结果报错如下
Uncaught TypeError: Cannot read properties of undefined (reading 'clientX')
at draw (index.html:136:49)
at animloop (index.html:154:13)
请问是缺了什么吗,我是用的原生js,该如何获取鼠标位置呢?