<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> div{ height: 150px; width: 150px; background:gold; } </style> </head> <body> <!-- onmousemove 鼠标在上面晃动就会一直加 onmousedown 鼠标点击一下就会加一 onmouseover 鼠标一放进去就加一 onmouseout 鼠标一拿出来就加一 --> <div onmouseout="down()"></div> </body> <script> function down() { console.log("down") //每点击一下加一 } </script> </html>
原文:https://www.cnblogs.com/TKOPython/p/12823595.html