Javascript - Track mouse position
<p>Click in the div element below to get the x (horizontal) and y (vertical) coordinates of the mouse pointer, when it is clicked.</p>
<div onclick="showCoords(event)"><p id="demo"></p></div>
<p><strong>Tip:</strong> Try to click different places in the div.</p>
<script>
function showCoords(event) {
var cX = event.clientX;
var sX = event.screenX;
var cY = event.clientY;
var sY = event.screenY;
var coords1 = "client - X: " + cX + ", Y coords: " + cY;
var coords2 = "screen - X: " + sX + ", Y coords: " + sY;
document.getElementById("demo").innerHTML = coords1 + "<br>" + coords2;
}
</script>
Also in JavaScript:
- nested formarray in angular 8
- clear input field jquery
- get left position based on container jquery
- javascript parseint string with comma
- cypress click
- fetch data from asyncstorage react native
- Beginning Node.js
- firebase storage javascript delete document
- Bidirectionnal model binding
- vue js Elements in iteration expect to have 'v-bind:key' directives
- react create array
- installing vuex
- how to check if the first letter of a string is capitalized or uppercase in js
- how to add objects in array in javascript
- indexof javascript duplicate arrays
- switch statement in javascript
- remove whitespace with regex javascript
- es6 array sum javascript
- ERROR in ./node_modules/tns-core-modules/ui/core/view/view.js Module not found: Error: Can't resolve '@nativescript/core/ui/core/view/view' in '/home/deepali/projects/supersquad-client/node_modules/tns-core-modules/ui/core/view'
- in angular click button hide div and show div
- get uploaded file name in js
- select2 disable search
- hide bootstrap modal jquery
- jquery check input is disable