473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Mouse position not working anymore

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

Jun 15 '07 #1
2 2552
On Jun 15, 6:34 pm, romain.lar...@gmail.com wrote:
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.
--
Rob

Jun 15 '07 #2
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,

On 15 juin, 10:48, RobG <r...@iinet.net.auwrote:
On Jun 15, 6:34 pm, romain.lar...@gmail.com wrote:
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.

--
Rob

Jun 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: George Hester | last post by:
This question is specific to Microsoft Internet Explorer 5 +. I have an input box that gets the focus when the page loads. Using a suggestion earlier here I have re-written the code better. At...
1
by: ids | last post by:
I have my own website and i want to use a mouse effect. My problem is that i use frames and when i put the javascript in the index.html like this: <html> <head> <meta name="keywords"...
4
by: masantha wee | last post by:
Hi all, I am using Firefox and embedding Javascript in html. I understand that we can use mouse events by coding them in the body of html (by creating a button or anything and by adding in the...
5
by: gsb | last post by:
I track the mouse location like this code: function mousePos(e) { var p = new Object(); if(e) { p.x = e.pageX; p.y = e.pageY; } else { p.x = event.x; p.y = event.y; } ... (show) }...
6
by: Carlos García-Carazo | last post by:
Hello, I am working on a C# application for an industrial machine, using Windows Forms, where the user could look at the screen from a 90 degree rotated position, like he could turn the monitor...
3
by: Tom | last post by:
I have a picturebox on my VB.NET form. The picturebox size mode is set to stretched. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and...
3
by: Morten Snedker | last post by:
If I have a number of random applications open, move the mouse cursor to a given position and do a click, the application gets the focus. That is what this simple code should illustrate: Dim...
4
by: mbatestblrock | last post by:
I hope this makes some sense. My ultimate goal here is to execute a block of code if the mouse has not moved in a minute or so within the broswer. The machine I am running this on is for internal...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.