Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Why Doesn't This Work In Firefox?

Reply
Thread Tools

Why Doesn't This Work In Firefox?

 
 
joey.powell@topscene.com
Guest
Posts: n/a
 
      05-22-2008
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!
 
Reply With Quote
 
 
 
 
Álvaro G. Vicario
Guest
Posts: n/a
 
      05-23-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) escribió:
> 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.


Current version is 2.0.0.14 so you've missed 3 updates


> 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...


I get an JavaScript exception but it doesn't hang in my computer:

e has no properties
if(typeof(e.pageX)=='number' && typeof(e.pageY)=='number')

I suggest you enable automated updates and see if hanging persists.
Also, get Firebug extension so you can debug more easily.


--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
why why why does function not work Horace Nunley ASP .Net 1 09-27-2006 09:52 PM
Re: WHY, WHY WON'T IT WORK??? Marina ASP .Net 2 06-29-2004 02:40 PM
Why oh why doesn't my data view work? David Prowak ASP .Net 1 01-30-2004 04:19 AM



Advertisments