![]() Tip: To get the vertical coordinate (according to the client area) of the mouse pointer, use the clientY property. ![]() In this example, I put the X- and Y-coordinate values in an input box, but you can tweak that to fit your needs.ĭocument.getElementById('cursorX').value = (window.Event) ? e.pageX : event.clientX + ( ? : ) ĭocument.getElementById('cursorY').value = (window.Event) ? e.pageY : event.clientY + ( ? : document.body. The clientX property returns the horizontal coordinate (according to the client area) of the mouse pointer when a mouse event was triggered. ![]() The coordinates x and y are interpreted in pixels relative to a position (0, 0) of the selected. If you want to be able to check your coordinates often. The clientX property returns the horizontal coordinate (according to the client area) of the mouse pointer when a mouse event was triggered. This function moves the mouse cursor to the position ( x, y ). The Javascript code below provides a sample of how the user’s mouse cursor position, displayed as X- and Y-coordinates in relation to the top left corner of the page. The system variable mouseX always contains the current horizontal position of the mouse, relative to (0, 0) of the canvas. Issue a set of commands to display the mouse coordinates in your Microsoft Windows computer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |