onmousemove events In Java Script

This event occurs when the user moves mouse. The x and y coordinates of the mouse pointer are trapped and when the position changes any of x or y this event fires. We can program the change of position of mouse on the web page using this event.
 
Example:
 
<html>

<head>

<title>events </title>

</head>

<body bgcolor=green text=yellow onmousemove=”ff()”>

<h4 align =center> Please move the mouse </h4>

<blockquote>

The X axis and Y axis position of Cursor on screen will be displayed in textbox

</blockquote>

name : <input type=”text” name=”t1″ onkeydown=”ff()”>

<script>

function ff()

{

t1.value=”” t1.value=”X : “+event.screenX + ” Y :”+event.screenY

}

</script>

</body>

</html>

Scroll to Top