document.onmousemove = judge is called when the mouse moves!!

<html>
<head>
</head>
<body>
123333
223
</body>

<script type="text/javascript" >
function judge(){
alert("mousemove");
//document.onmousemove = null;/ /Cancel mouse movement simulation
}
function simulateMouseMove(){//Simulate mouse movement
document.onmousemove = judge;
}
window.onload=simulateMouseMove;//Window loading
</script>
</html>

Effect: The mouse will move on the page Trigger event

Similarly , change document.onmousemove = judge; to
document.onclick = judge;  
effect: Clicking the mouse on the page will trigger the event

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327015527&siteId=291194637