This article mainly introduces how js uses onmousemove and onmouseout to obtain mouse coordinates. It involves javascript mouse event operations and has some reference value, for more information about how to use onmousemove and onmouseout to obtain mouse coordinates, see the example in this article. Share it with you for your reference. The details are as follows:
The following js Code demonstrates the usage of onmousemove and onmouseout events. When the mouse moves within a specified area, the mouse coordinate information is dynamically displayed.
Script function myFunction (e) {x = e. clientX; y = e. clientY; coor = "Coordinates: (" + x + "," + y + ")"; document. getElementById ("demo "). innerHTML = coor} function clearCoor () {document. getElementById ("demo "). innerHTML = "";} scriptMouse over the rectangle above, and get the coordinates of your mouse pointer.
I hope this article will help you design javascript programs.