javascript track mouse pointer

Solutions on MaxInterview for javascript track mouse pointer by the best coders in the world

showing results for - "javascript track mouse pointer"
Vanessa
04 Jan 2021
1var pointerX = -1;
2var pointerY = -1;
3document.onmousemove = function(event) {
4	pointerX = event.pageX;
5	pointerY = event.pageY;
6}
7setInterval(pointerCheck, 1000);
8function pointerCheck() {
9	console.log('Cursor at: '+pointerX+', '+pointerY);
10}
Ben
29 Jan 2019
1// Cursor coordinate functions
2var myX, myY, xyOn, myMouseX, myMouseY;
3xyOn = true;
4
5function getXYPosition(e) {
6    myMouseX = (e || event).clientX;
7    myMouseY = (e || event).clientY;
8    if (document.documentElement.scrollTop > 0) {
9        myMouseY = myMouseY + document.documentElement.scrollTop;
10    }
11    if (xyOn) {
12        alert("X is " + myMouseX + "\nY is " + myMouseY);
13    }
14}
15function toggleXY() {
16    xyOn = !xyOn;
17    document.getElementById('xyLink').blur();
18    return false;
19}   
20
21document.onmouseup = getXYPosition;
Dante
21 Apr 2016
1<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>
2
3<div onclick="showCoords(event)"><p id="demo"></p></div>
4
5<p><strong>Tip:</strong> Try to click different places in the div.</p>
6
7<script>
8function showCoords(event) {
9  var cX = event.clientX;
10  var sX = event.screenX;
11  var cY = event.clientY;
12  var sY = event.screenY;
13  var coords1 = "client - X: " + cX + ", Y coords: " + cY;
14  var coords2 = "screen - X: " + sX + ", Y coords: " + sY;
15  document.getElementById("demo").innerHTML = coords1 + "<br>" + coords2;
16}
17</script>
queries leading to this page
js get mouse position in windowposition of mouse in jshow to tie e client x and y to coordinates in cssjs how to get mouse positionjavascript get pointer position addeventlistenerclientx in javascripttjavascript mouseevent positionposition of the mouse jstrack mouse pointer jshow to get mouse position in jsjavascript how to get mouse x and ymouse coordinates jsmouse x mouse y jsjs get mouse cordsjs event positionjs getmouseposjavascript get position of mousehow to get the correct mouse position in javascriptjavascript mousemove get mouse position get mouse positionget mouse position jsdisplay the mouse x and y coordinates in jsget mouse pos in jsjs mouse coordinates windowhow to get on mousemove in cursor position in javascriptjs track mouse positiontypescript get mouse location from eventget mouse event coordinatesevent get mouse positiontracking mouse position javascriptjavascript track mouse movementjavascript find the location of the mousejava scrpt get mouse positionjs get mouse posjs event listener mouse movehjs mouse positionhow to get mouse position javascript htmlposition of mouse javascriptget mouse pos in hjavascripthow to get mouse position on a div in javascriptmouse x jsjs mousemoveget mouse position of page in javascriptgive clientx and clienty to div in javascripthow to get exact coordinates of mouse click in javascriptjavascript e clientxhow to get the mouse position jsjavascript mouse event get coordinateshow to calculate mouse move y coordinates in javascripthow to get the position of your mouse in javascriptmouse click x y javascripthow to get cursor coordinates in javascriptjavascript get mouse coordinatesmouse offset html mouse position eventconsole log mouse positionjavascript show mouse coordinateshow to get mouse coordinates on click in javascriptget mouse x y coordinatesposition of mouse in html javascriptjs cursor trackjavascript mouseover get coordinatesjavascript html get current mouse positionmousemove javascriptcan we get mouse dom reference in javascriptmousemove coordinates javascriptjavascript html mouse coordinatesknow the position of the mouse javascriptget position of mouse with javascriptjs mouse coordinatesget position of element javascripthow to get mouse click position in javascriptjavascript track mouse positionhow to get coordinates of mouse click in javascriptmouse position in javascriptget mouse position from eventprint coordinates in jsget cursor location javascripttrack mouse position x and yhow to get the mouse position in jsjavascript get pointer positionjavascript mouse locationgettin mouse position jsjavascript position cursortooltip positioning event jsevent clientxhow to get the dom position of mouse in javascriptjavascript get mouse positionhow to get mouse postion with javascriptjavascritp get mouse position relatiev to an elemthow to get mousemove position in javascripttrack cursor position javascripthow to get mouse x and y in javascriptget position mouse element javascripthow to know coordinate of mouse javascripthow to get the coodernate of the mouse in javascriptconsole mouse x and y on movejs track mousecursor 27s position 28its x and y coordinates 29 jshow to get the mouse position in javascriptmousex jstrack the mouse position with javascriptget mouse position canvasget position of mouse pointer javascripthow to get mouse position in the browser jsjavascript log mouse positionhow to know your pointer coordinates on html pageget mouse coordinates jshow to get mouse position jshow to get mouse coordinates with javascriptjavascript get mouse coordsget position mouse is on the element jsget current mouse location javascripthow to read mouse position jsget mouse click coordinates canvas jsget the current mouse position javascriptjs get mouse position windowcurrent mouse position javascriptunity get mouse positionget position of cursor javascriptget x y position of mouse javascriptjs get cordinates of the mousehow to get mouse position in java scriptwhat is mouse x and y javascriptevent get mouse coordinateshtml get current mouse positionjavascript get mouse poiter positionjs mouse event get mouse positionget pointer position javascriptcords input javascriptget position of mouse in jstrack mouse position javascripthtml mouse positionjavascript clientxfind point of cursor javascriptjs get mouse position in elementjavascript how to get mouse positionhow to get the cursor pointer position in jsjavascript detect mouse position javascript mouse positonjavascript show mouse positionget position of mouse javascriptdocument addeventlistener 28 22onmousemove 22position mouse javascriptjavascript get mousepositonjs get mouse positionshow mouse pointer location below the pointer in jsjavascript track mouse positionjavascript get exact mouse positionhow can we find the coords of mouse position jsjs detect mouse coordinateshow to have clientx and clienty return coordinates of a particular element jsget mouse position in javascriptdom event javascript clientxget mouse position javascript functionjs get cursor position on documentjs get mouse positoinjs position cursorget mouse loaction in javascripthow to find position of mouse pointer in javascripthow to get the coordinates of the mouse in javascriptfind mouse position javasciptget mouse position on clickjava script mouse move coordinatesjs track mouse locationclientx and clienty in htmlhow to detect the position of the mouse in javascriptjs get mouse coordinates on moveget mouse coordsget mouse coordinates javascripthow to get mouse location in javascriptclientx menu manager resetget current mouse pointer position javascriptget the mouse x yjs events mouse xhow to get the current mouse position in javascriptcapture mouse movement jsget mouse position xclientx jsget cursor position javascriptjavascript mouse positionmouse x y javascripthow to get mouse position in javascriptusing javascript can i get the coordinates of the mouse pointerclientx and clienty in javascriptget cursor position jsmouse event pointer positionjavascript get element with mouseget the mouse position javascripthow to get the cursor pointer coordinates using jsfind location of mouse pointer javascriptclientx javascriptjavascript getting mouse positionget mouse position javascritget mouse current position javascriptget x and y position of mouse javascriptwant to get mouse position in jsposition mouse jsget mouse locartion jsjavascript mouse coordinatesjs get element at mouse posmouse position tracking javascripthow to calculate mousemove y coordinates in javascriptjavascript get current mouse positionupdate mouse position javascriptget mouse position htmljavascript mouse x and ylisten to mouse location jsmouse coordinates on clickmouse position on page javascriptget mouse x y coordinates javascriptget mouse coordinateshow to detect mouse position in javascriptget mouse position in jsmouse x mouse y java scriptget user mouse position javascripthow to track mouse movement in javascriptjs get mousexget mouse pos jsjavascript event mousexjs get mouse x yjs get mouse position on click javascript get position on mouse overjavascript get mouse position on hovercursor position in javascripthow to get current mouse coordinates jsclientx and clienty in jshow to know the mouse place cordinats jsmouse click position javascripthtml canvas get mouse positionevent clientxmouse coordinates in jsget coordinates from mouse javascriptget mouse x position javascriptget mouse coordinates on clickmouse coordinates in javascripttrack javascript mouse eventjs event mouse positionget mouse position element javascriptthe mousemove eventjs get mouse position x 2cyevent mousexjavascritpt get mouse positionmousemove eventget mouse position function javascriptmouse coordinates javascriptjs detect mouse positionvanilla js get cursor positionget current mouse position in javascripthow to check mouse coordinates jshow to get mouse in javascriptjavascript get x y mousejavascript get x position of mousehow to get current mouse position in javascripthow to get the mouse position using javascriptcapture x and y coordinates of mousejavascript get cursor x y positionget mouse coordinates in jsget mouse coordinate jsjavascript get mouse position in element on mousemovejs mouse move get cursor coordinatesjavascript current mouse positionhow to get mouseposition javascriptget javasccript mousejavascript track mouse pointerget live coordinates of mouse with javascriptmouse position js livemouse position jsdocument js get mouse positionget mouse position javascript on mouse movejavascript show current mouse positionjavascript get cursor positionget x and y of mouse on screen jsjs mouse xget where mouse is on page javascriptevent clientjs get mouse movementget coordinates of mouse click javascriptclientx property javascriptget mouse coordinates in javascriptselenium get mouse coordinates pythonget position of mouse codehs jsclientx in javascriptjavascript calculate mouse movementjavascript event target coordinatesjavascript track mouseget pointer position on pagewindow get mouse positionjs mousemove get mouse positionget current mouse position jshow to print mouse position in javascriptjavascript track mouse pointeconsole log position of mouse pointer in javascriptjs getting mouse coords returning objectget mouse click coordinates javascriptmouse in mouse out javascriptjs document ouse positionget mouse position how to find mouse coordinates in javascriptevent clientx propertiesjs get mouse coordinateshow to get mouse xy xoordinates in jsjavascript get mouse x and yjs mouse coordinates window get mouse pointer position in javascriptget element mouse position javascriptjavascript get mouse position changeposition of mouse jsget element by mouse position javascriptfind mouse position javascriptjava script get mouse coordinateshow to get mouse position javascriptget mouse x jsshow x and y coordinates of mouse javascriptevent target coordinates htmljavascript get position of mouse on pageconsole log mouse positionhow to make track the position of the mouse in javascripttake mouse position javascriptmouse x position javascriptevent clientx javascriptjs track mouse movementdocument addeventlistener 28 27mousemove 27 onmousemove 29get current mouse coordinates javascriptget mousex in jswrite text on cursor click using javascript event clientxget mouse position javasxcriptget mouse pos in javascripthow to get the position of the mouse in javascripthow to get mouse position jsavascirptmouse offset javascriptshow mouse position on canvas jsmouse position javascriptget mouse location from event javascripthow to find mouse position in javascriptjs log click locationjs track cursorcheck mouse position javascriptjavascript position of cursorget mouse location jsget position cursor javascriptget mouse ymouse move event listener jsget exact mouse position javascripthow to set mouse position in javascriptjavascript get mouse locationjs mouse pointer positionjs get current mouse positiongetmouseposition 28event 29 function javascriptget mouse location javascriptjs get position of mousejavascrip current mouse positiongetting mouse position javascripttrack mouse movement jsgetmouseposition 28event 29 javascriptget mouse pointer coords jsget pointer positionclient x and y in reacthow to display mouse coordinates in javascriptgett mouse position jsjavascript get current mouse position clickhow to get mouse pointer position in javascriptclientx of element in jsjs if user mouse movejavascript get current mouse locationget mouse position javascriptget position of mouse in button jshow to get mouse cursor coordinate using jshow to get the mouse position in js 3fjs get mouse datamouse x and yhow to get current mouse location jsjs get mouse postitionhow to display the data when we place mouse on object in javascripthow to get the coordinates of mouse in jsjs mouse event get mouse coordinateshow to track mouse position in jsjavascript how to get the position of the mousewindow mouse position jstrack mouse pointer javascriptjavascript listen mouse positionhow to see mouse position javascriptcalculate the position of mouse on x axis javascriptjavascript get mouselocationmouse click coordinates javascripthow to get the mouse coordinates in javascriptjs geting the mouse positionjs get mousejs display mouse coordinatesmouse x 2c y jsjavascript display mouse coordinatespos x and y in javascriptget mouse x and y javascriptmouse event listener javascript mouse coordinatesget mouse input jshow to get position of mouse in javascriptget mouse position javascript relative to elementjavascript get mouse click positionmousemovejs mouse event positionget mouse coordinates from eventmouse in and out javascriptjquery clientxjs content moving to mousehow to set x and y to move mouse in jsjavascript e xyjavascript get mouse coordinatehow to control mouse coordinates in javascriptget y position of mouse javascripthtml get mouse positiondocument get mouse positionpointer position javascriptmouse current position javascriptmouse pos jsevent x javascriptjs get cursor positionhow to find mouse coordinates js get x and y of mouse javascriptget curser axis in jsjavascript get users mouse positionhow to get mouse coordinates in javascriptjavascript get mouse position on divmouse coordinate in jshtml javascript get mouse positionjs pointer positionmouse position javascript htmlhow to mouse track from 3chtml 3ejs get pointer positiondetermine mouse coordinates using jsjs get mouse position on mouse moveaccess mouse position javascriptmouse x and y javascriptget mouse x javascriptjs mouse positionjavascript get co ordinates of mouseget mouse position javascript in divhow to get mouse coordinates on jsjavascript get mouse position on pagecoordinates on 2cmouse move htmltrack mouse pointer location jsmouseposition jsjs get mouse coordsjavascript get mouse position on mouse movejavascript mouse position on htmls pagetrack mouse jsget mouse positionhow to get mouse information javascriptconsole log mouse position jshtml how to get mouse positionget coordinates from mouse eventhow to find the mouse position in javascriptjavascript track mouse pointmouse pointer coordinates jsdetectmouse position javascriptjavascript get mouse position in elementgetmouseposition jsjavascript get mouse position w3schoolsfind mouse coordinates jsget position of mouse jshow to get pointer position in javascript 5cjs cursor positionget mouse locationknow mouse location javascriptjs get mouse locationgetmousecoords javascriptjs mopusemoveget position of mouse eventmousex javascriptjavascript client xjavascript coordinates mousejs mouse pointer librarygetmouseposition javascriptgetr mouse position jsmouse cursor position javascriptjs get mouseposget pointer position jscoordinate of mouse htmlevent mouse coordinates javascriptmouse coordinates htmljs client posget mouse position on window javascriptget moiuse position in htmlmouse coordinate javascriptjavascript get mouse positionget current mouse position javascriptget mouse position javascript in a divhow to get access mouse on element in javascriptget coordinates on mouse mvoeget location of mouse javascriptget mouse position on screenmouse x javascriptget position mouse javascripthow to get the coordinate of our mouse in javascripttest mouse y 2fx jsupdate mouse location javascriptmouse location javascriptou mouse mouve get positionjs event positionxhow to get mouse position in an elementjs function true on mousejavascript get mouse position without eventtrack mouse event javascripthow to get x y mouse position in javascripthow to access clientxjavascript get position mousejavascript get current mouse coordinatesjavascript mouse lockationset the mouse position in javascript javascript save mouse positionhow to get mouse coordinates javascripthow to track mouse position in javascriptget mouse postiion javascriptget mouse with jsdetect mouse position javascriptmouse x and y w3 schoolsjavascript get mouse posiitonget position of mouse on element jsget mouse position by jsget current position of mouse javascriptjs have position of mouseget mouse position in element javascriptjavascript track mouse pointer