473,795 Members | 3,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2575
On Jun 15, 6:34 pm, romain.lar...@g mail.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.sta tus = 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...@g mail.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
1624
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 least I think so. Anyway when the user clicks in the box (onmousedown) if they have visited the site in the past a drop down will appear showing previously entered information. If the drop down is longer then the box is wide then it seems...
1
1851
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" content="vacation"> <meta name="GENERATOR" content="Microsoft FrontPage 5.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <title>Vacation</title>
4
3666
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 events in the <img> tag). <input id="StdDev Value" name="StdDevButton" type="button" value="Standard Deviation Value" onclick="readStdDevValue()"/>
5
7969
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) } document.onmousemove=mousePos; Seems to do fine on many browsers.
6
10817
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 to leave it standing on its left (or right) side. There are many ways to show a "turned" interface in this case, but the problem is that when he moves the mouse right, in a turned screen the mouse cursor goes down (or up), when he moves it up...
3
63443
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 display (in the status bar) the image coordinates of the mouse location. However, if I use the picturebox's MouseMove event, I am getting the coordinates of the mouse over the PICTUREBOX, not the actual image underneath that (which is stretched)....
3
3769
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 pt As Point Dim wnd As IntPtr Const WM_LBUTTONUP = &H202 '//LButton up Const WM_LBUTTONDOWN = &H201 '//LButton down
4
3525
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 use only, so I have no fear of this not working in certain browsers, etc. I am no javascript pro but know enough to catch on if anyone is kind enough to help me out here. One of the only ways I could see this working is by having js check the...
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.