Mouse position not working anymore

R

romain.larmet

Hi all,

I need to get the mouse cursor's position using JavaScript. Until now,
everything was working well in IE, FF and Opera using the
event.clientX/Y and e.pageX/Y members, depending on which browser is
used.
However, I've made some modifications (I don't remember what precisely
but nothing related to this component, in fact) and now this portion
of JavaScript code isn't working anymore.
Now, the cursor's position are still "undefined", even if the
mousemove handler is indeed executed. The strange thing is that this
behaviour occurs in all 3 browsers, which means that not only
event.clientX/Y returns undefined, but also e.pageX/Y for Firefox...
Any idea on why these coordinates are not available anymore?

Thanks
 
R

RobG

Hi all,

I need to get the mouse cursor's position using JavaScript. Until now,
everything was working well in IE, FF and Opera using the
event.clientX/Y and e.pageX/Y members, depending on which browser is
used.
However, I've made some modifications (I don't remember what precisely
but nothing related to this component, in fact) and now this portion
of JavaScript code isn't working anymore.
Now, the cursor's position are still "undefined", even if the
mousemove handler is indeed executed. The strange thing is that this
behaviour occurs in all 3 browsers, which means that not only
event.clientX/Y returns undefined, but also e.pageX/Y for Firefox...
Any idea on why these coordinates are not available anymore?

Perhaps you have a script error? :)

Seriously, it is a bit much to expect anyone to debug a script they
can't see based on a very general description of the situation: "I had
a function that worked, I made some changes that I can't remember and
now it's broken - what could be wrong?".

Go back to a version of your script file that works and apply your new
changes one by one. Alternatively, create a test case that shows the
error using *only* the positioning function. Remove as much as you
can from the script file that keeps the error.

Your error is in the remaining bit (I hope it's small). You will
likely find the error before you get this far.
 
R

romain.larmet

Hi Rob,

Thank you for your relpy. I know my description was vague, but I can't
give you code, since the same function being executed in another page
works perfectly.
Of course there isn't any JavaScript error (at least, not that the 3
browsers complain about). It's just that mouse coordinates are always
undefined.
Even a simple mousemove handler like "window.status = event.clientX;"
will show "undefined" in the status bar.
Now, of course on my side I'm trying to get back changeset by
changeset to find out what caused the problem to appear, but meanwhile
I was just trying to know if there is a known behaviour which causes
the mouse coordinates to become unavailable?

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top