HTML event attribute onmousemove








The onmousemove attribute event is triggered when the mouse pointer is moving over an element.

What's new in HTML5

None.

Syntax

<element onmousemove="script or Javascript function name">

Supported Tags

All HTML elements, EXCEPT:

<base>, 
<bdo>, 
<br>, 
<head>, 
<html>, 
<iframe>, 
<meta>, 
<param>, 
<script>, 
<style>, 
<title>




Browser compatibility

Yes Yes Yes Yes Yes

Example

<!DOCTYPE html>
<html>
<body>
<!--   w  w  w  . j a v  a2  s  . c om-->
<p id="p1" onmousemove="onmouseMove()" onmouseup="mouseUp()">
Click the text! 
</p>

<script>
function onmouseMove() {
    console.log("move");
}

function mouseUp() {
    console.log("up");
}
</script>

</body>
</html>

Click to view the demo