Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript: How can I Know the mouse pointer position?

Status
Not open for further replies.

louis22

Technical User
Apr 17, 2002
2
GB
I am writting my DHTML page using JavaScript and I need to know How to read the mouse pointer position.
I hope you can help me to solve this problem.
Thank you.
 
onMouseMove store the contents of window.event.clientY and clientX in IE


jared@aauser.com
 
use the onMouseMove to call the script,

in it use the
window.event.clientY and clientX attributes which will return the current position of the mouse pointer
 
Try this in the HEAD tags in a HTML page(IE)
<SCRIPT LANGUAGE=&quot;JavaScript&quot; FOR=&quot;document&quot; EVENT=&quot;onmousedown&quot;>
var mY = 0;
var mX = 0;
mX = event.clientX
mY = event.clientY
alert(&quot;X = &quot; + mX + &quot;: Y = &quot; + mY);
</SCRIPT>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top