为啥鼠标移动不执行onmousemove事件
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>fuction</title> <style type="text/css"> .box{ width: 200px; height: 200px; background: red; } </style> </head> <body> <div id="box" class="box">拖动</div> <script type="text/javascript"> var box = document.getElementById("box"); box.onmousedown=function(){ console.log("box被按下"); } box.onmousemove=function(){ console.log("box被移动了"); } box.onmouseup=function(){ console.log("box被松开"); } box.onclick=function(){ console.log("我被点击了"); } box.onmouseover=function(){ console.log("在盒子里面"); } box.onmouseout=function(){ console.log("滑到盒子外面"); } </script>> </body> </html> 在chrome浏览器下,鼠标移动事件只有在点击的时候会执行一次,在里面移动不执行是怎么事啊
12
收起
正在回答 回答被采纳积分+1
3回答
前端小白入门系列课程
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星