HTML onmousemove Attribute

HTML onmousemove Attribute: This attribute fires when the pointer is moving while it is over an element. This attribute contains a single value script which works when onmousemove attribute called. The onmousemove attribute triggers when the mouse pointer moves over the element.

HTML onmousemove Attribute

This attribute can be applied to all the HTML elements.

Syntax:<element onmousemove = “script”>

Browser Support:

This attribute is supported by the following browsers:

  • Chrome
  • Firefox
  • Opera
  • Safari
  • Internet Explorer

Example: for <img> element

<!DOCTYPE html>
<html>
<body>
<img onmousemove="bigImg(this)" onmouseout="normalImg(this)" border="0" src="smiley.gif" alt="Smiley" width="32" height="32">
<script>
function bigImg(x) {
  x.style.height = "64px";
  x.style.width = "64px";
}

function normalImg(x) {
  x.style.height = "32px";
  x.style.width = "32px";
}
</script>
</body>
</html>

Output:

HTML onmousemove attribute