Last Updated : 15 Jun, 2023
The DOM onmousemove event in HTML occurs when the pointer is moved over an element.
Supported Tags: It supports All HTML elements, EXCEPT:
Syntax:
<element onmousemove="myScript">
object.onmousemove = function(){myScript};
object.addEventListener("mousemove", myScript);
Example: Using the addEventListener() method
HTML
<!DOCTYPE html>
<html>
<head>
<title>
HTML DOM onmousemove Event
</title>
</head>
<body>
<h1 id="eleID">GeeksforGeeks</h1>
<p id="demo"></p>
<script>
document.getElementById(
"eleID").addEventListener(
"mousemove", function (event) {
GFGfun(event);
});
function GFGfun(event) {
alert("A computer science portal")
}
</script>
</body>
</html>
Output:
Supported Browsers: The browsers supported by DOM onmousemove event are listed below:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4