Forum Moderators: open
The following code shows the x,y coordinates of the mouse in the status bar. It works fine in IE, but I have two problems in Safari:
(1) The X coordinate is relative to the window, not the screen.
(2) The Y coordinate is inverted! That is, 0 is on the BOTTOM of the window and gets higher as you move the mouse UP.
Here's my code. I spent over an hour scouring the search engines but turned up nothing. Any ideas?
Thanks for your help, -MBJ-
-------------------------
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;function getMouseXY(e) {
if (IE) {
tempX = event.screenX
tempY = event.screenY
}
else {
tempX = e.screenX;
tempY = e.screenY;
}if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}
window.status = tempX+","+tempY;
return true;
}
If you find a bug in Safari you should report it to Apple using the link in the Safari menu - then stay tuned to [weblogs.mozillazine.org...] for updates.