View Full Version : How to find the mouse-position without events?

02-19-2007, 06:15 PM
How to find the mouse-position without events?

I have set an Interval with setInterval that calls a function every second.
How could this function find out the mouse position?

Addidtional question, that I will put in a new thread too:
How to create an event, like described on the W3C-site about the events?


Good to be back on this good forum!

02-19-2007, 07:09 PM
have a look here:
"Capturing Mouse Position"

02-19-2007, 07:15 PM
That uses the onmousemove-event too.
The problem with this event is that it uses much of the CPU, the CPU-load goes high from 0 to 100 percent if moving fast with the mouse.
That's not good.

I bet there is a way to find the mouse-position, at least in Firefox I hope.

(The Javascript is intended to run mainly from one's own computer anyway, so not online, but just save the html as file and display it.)

By the way: I'm using Firefox (1.6 in the moment, maybe 2.0 soon) on Windows XP. I only need a solution for Firefox in the moment.


02-19-2007, 07:24 PM
runs fine on my system and doesn't use any cpu at all.

however, on your script "setInterval that calls a function every second"
this will cause the cpu usage to go very high and will eventually crash the browser.