Set element's pixelTop and pixelLeft to current mouse event (IE) : Mouse Event « Event « JavaScript Tutorial






<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
function moved()
{
    window.status = "Current mouse coordinates: X = " + event.x + " Y = " + event.y
    follower.style.pixelTop = event.y
    follower.style.pixelLeft = event.x
}
//  -->
</script>
</head>
<body onmousemove="moved()">
<p id="follower" style="position:absolute">Squeak!</p>
</body>
</html>








15.8.Mouse Event
15.8.1.Get mouse clicked button
15.8.2.Is Shift key pressed during the mouse click
15.8.3.Is alt key pressed during the mouse click
15.8.4.Is control key pressed during the mouse click
15.8.5.Mouse event target element name
15.8.6.Mouse event from and to elements (IE)
15.8.7.Mouse event related element (Firefox)
15.8.8.onmouseover event handler
15.8.9.onmouseout event handler
15.8.10.onmousedown event handler
15.8.11.onmouseup event handler
15.8.12.onclick mouse event handler
15.8.13.ondblclick mouse event handler
15.8.14.Display current mouse position in status bar (IE)
15.8.15.Use mouse in/out action to trigger the style change
15.8.16.Get mouse client X and Y
15.8.17.Get mouse screen X and Y
15.8.18.Set element's pixelTop and pixelLeft to current mouse event (IE)
15.8.19.Get X/Y screen position (IE)