Assign mouse move event coordinate to element style
|
|
<html> <head> <title>Simulated Drag And Drop Example</title> <script type="text/javascript"> function handleMouseMove(oEvent) { var oDiv = document.getElementById("div1"); oDiv.style.left = oEvent.clientX; oDiv.style.top = oEvent.clientY; } </script> </head> <body onmousemove="handleMouseMove(event)"> <P>Try moving your mouse around.</p> <div id="div1" style="background-color: red;height: 100px;width: 100px;position: absolute;"> Test </div> </body> </html>
|
|
|
HTML code for linking to this page:
Related in same category :
-
-
-
-
-
-
|