J
joey.powell
Hello,
I am working on a mapping application where I need to be able to
determine the mouse cursor position on the browser screen. I have done
a lot of reading about this...apparently one should
use .pageX / .pageY for Firefox and e.clientX / e.clientY for Internet
Explorer.
In my page I have the following code segment. It works great for IE,
but it always hangs (does not advance to the next line of code) on
reference to .pageX or .pageY when using Firefox. The version I am
using is 2.0.0.11. This does not make any sense to me as every example
I have seen involves using .pageX and .pageY with Firefox.
What is causing it to hang?
function GetMouse(e)
{
if(!e) { e=window.event; }
//GETS TO HERE
if(!e || (typeof(e.pageX)!='number' && typeof(e.clientX)!
='number')) { xcoord=0;ycoord=0; }
if(typeof(e.pageX)=='number' && typeof(e.pageY)=='number')
{
//NEVER MAKES IT HERE
var xcoord=e.pageX;
var ycoord=e.pageY;
}
//OR HERE!
....more code...
Please tell me what I am doing wrong here. Thanks!
I am working on a mapping application where I need to be able to
determine the mouse cursor position on the browser screen. I have done
a lot of reading about this...apparently one should
use .pageX / .pageY for Firefox and e.clientX / e.clientY for Internet
Explorer.
In my page I have the following code segment. It works great for IE,
but it always hangs (does not advance to the next line of code) on
reference to .pageX or .pageY when using Firefox. The version I am
using is 2.0.0.11. This does not make any sense to me as every example
I have seen involves using .pageX and .pageY with Firefox.
What is causing it to hang?
function GetMouse(e)
{
if(!e) { e=window.event; }
//GETS TO HERE
if(!e || (typeof(e.pageX)!='number' && typeof(e.clientX)!
='number')) { xcoord=0;ycoord=0; }
if(typeof(e.pageX)=='number' && typeof(e.pageY)=='number')
{
//NEVER MAKES IT HERE
var xcoord=e.pageX;
var ycoord=e.pageY;
}
//OR HERE!
....more code...
Please tell me what I am doing wrong here. Thanks!