Set element's pixelTop and pixelLeft to current mouse event (IE) : Mouse Event : Event JAVASCRIPT TUTORIALS


JAVASCRIPT TUTORIALS » Event » Mouse Event »

 

Set element's pixelTop and pixelLeft to current mouse event (IE)

















<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>







HTML code for linking to this page:

Follow Navioo On Twitter

JAVASCRIPT TUTORIALS

 Navioo Event
» Mouse Event