473,657 Members | 2,435 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mouse position in FireFox / NS

I got this working in all browsers but FF/NS. It's not picking up the
event to find the mouse position.

In a perfect world, you mouse over the link and a mouse bubble pops up.

Thanks for help.
scot

Aug 8 '05 #1
6 30035
"scot_nery" <sc**@juggle.co m> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Crap... http://dev.juggle.com/bubbletest.html
there.


If you copy this one, make sure you put the mouse bubble a bit away from the
mouse location, other wise dragging the mouse from left to right over the
link makes the bubble flash. (Try it). Probably because as you drag the
mouse right it is no longer over the link, but over the mouse bubble
instead, and thus onmouseout is called and the bubble dissapears.

Ross
Aug 8 '05 #3

scot_nery <sc**@juggle.co m> wrote in message news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
I got this working in all browsers but FF/NS. It's not picking up the
event to find the mouse position.


// It's best to monitor mouse co-ordinates with a dedicated handler:

var mouseX, mouseY;

function getMousePos(e)
{
if (!e)
var e = window.event||w indow.Event;

if('undefined'! =typeof e.pageX)
{
mouseX = e.pageX;
mouseY = e.pageY;
}
else
{
mouseX = e.clientX + document.body.s crollLeft;
mouseY = e.clientY + document.body.s crollTop;
}

}

// You need to tell Mozilla to start listening:

if(window.Event && document.captur eEvents)
document.captur eEvents(Event.M OUSEMOVE);

// Then assign the mouse handler

document.onmous emove = getMousePos;

// Then your mouseover function can just read mouseX and mouseY directly.

--
Stephen Chalmers http://makeashorterlink.com/?H3E82245A

Aug 8 '05 #4
It's a success story. Thanks tons for the help. Can't we all just get
along, my fellow browsers?

http://dev.juggle.com/bubbletest.html

Aug 9 '05 #5
Stephen Chalmers wrote :
scot_nery <sc**@juggle.co m> wrote in message news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
I got this working in all browsers but FF/NS. It's not picking up the
event to find the mouse position.
// It's best to monitor mouse co-ordinates with a dedicated handler:

var mouseX, mouseY;

function getMousePos(e)
{
if (!e)
var e = window.event||w indow.Event;


This manner of coding is not recommendable, IMO. In javascript strict
mode (reporting warnings), Firefox will report that "variable e hides
argument". This manner of coding just makes debugging more difficult.

I recommend
var TheEventObject;
if(e)
{
TheEventObject = e;
}
else if(window.event )
{
TheEventObject = window.event;
}
else
{
TheEventObject = null;
};
if('undefined'! =typeof e.pageX)
{
mouseX = e.pageX;
mouseY = e.pageY;
}
else
{
mouseX = e.clientX + document.body.s crollLeft;
This will work in MSIE 5 but what if the document triggers standards
compliant mode in MSIE 6? In such case, the provided code will not
succeed as the root element is not the same.
As written, the code [indirectly] is not promoting web standards. As
written, the code is more backward-compatible than forward-compatible.
mouseY = e.clientY + document.body.s crollTop;
}

}

// You need to tell Mozilla to start listening:

if(window.Event && document.captur eEvents)
document.captur eEvents(Event.M OUSEMOVE);


Why not register the listener to the object with DOM 2 Events method?
It's forward-compatible. Future-proof.

Gérard
--
remove blah to email me
Aug 12 '05 #6
Gérard Talbot <ne***********@ gtalbot.org> wrote in message news:3m******** *****@uni-berlin.de...
Stephen Chalmers wrote :
scot_nery <sc**@juggle.co m> wrote in message news:11******** **************@ g44g2000cwa.goo glegroups.com.. .

var mouseX, mouseY;

function getMousePos(e)
{
if (!e)
var e = window.event||w indow.Event;


This manner of coding is not recommendable, IMO. In javascript strict
mode (reporting warnings), Firefox will report that "variable e hides
argument". This manner of coding just makes debugging more difficult.


That level of warning is intended to advise of possible pitfalls, not errors. I know that if I choose conditionally to
overwrite a passed parameter, then I must be aware that any initial value may be lost.
if('undefined'! =typeof e.pageX)
{
mouseX = e.pageX;
mouseY = e.pageY;
}
else
{
mouseX = e.clientX + document.body.s crollLeft;


This will work in MSIE 5 but what if the document triggers standards
compliant mode in MSIE 6?


That can happen only if the programmer brings it about, in which case he will know what to expect and amend the code
accordingly. I didn't want to clutter my demonstration with the cascade of questions that must be asked to cover that
contingency.

// You need to tell Mozilla to start listening:

if(window.Event && document.captur eEvents)
document.captur eEvents(Event.M OUSEMOVE);


Why not register the listener to the object with DOM 2 Events method?
It's forward-compatible. Future-proof.


Here I must bow to your clairvoyancy, however I don't seem to know the syntax for making it past-proof, which remains a
concern. On the planet where all users upgrade at the first opportunity, your advice may be of some value, but not where
I reside.

--
Stephen Chalmers
547265617375726 520627572696564 206174204F2E532 E207265663A2054 51323437393134

Aug 13 '05 #7

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

Similar topics

2
7326
by: Smiley | last post by:
I want one end of a line to follow the mouse?
4
14712
by: Jay | last post by:
Hi, How can I capture mouse position on Image? I found number of script capturing mouse position of the page. But I could not find anything based on image. What I want to find out is X Y coordinates of mouse position. based on left of the top of my image is 0 0 (X Y coordinates) otherwise, I need to find out position of my image so I can calculate.
19
5927
by: wmanzo | last post by:
I have a really professional conspiracy movie site and I use tons of layers and an external scroll bar assembly. I would like to put the various sections into MS Iframes and in order to clean up the page but I find that the iframes interfere with the getting the mouse coords from the screen which is essential in moving the scroll bar around. My test html is given below. With the iframe hidden the mouse coords are obtainable. With the...
1
5371
by: Sim | last post by:
Hello NG, I try to use drag and drop function between two list views. For this I found following code: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchimpdragdrop.asp It works fine, but I have another problem. I want to create functionality like a Windows Explorer. This means, if I select some items from list view No 1 and drag&drop this to the list view No 2, then I want to mark automatically
4
26483
by: vunet.us | last post by:
I have a DIV element. How can I find mouse position (top and left) inside of this DIV? <div onMouseMove="getPositions();" style="width:200px;height:100px"></div> function getPositions(ev){ ???????????????? }
1
1906
by: Terry | last post by:
Hi again folks, After getting my page (http://theamazing.onlinewebshop.net/spotlight/) to work in Firefox and Safari. I thought I would try to get in working in IE. My attempt is here: http://theamazing.onlinewebshop.net/light/ Unfortunately, the transparent window is not enclosing the mouse
1
1428
by: ranpelt | last post by:
Hi folks, After getting my page (http://theamazing.onlinewebshop.net/spotlight/) to work in Firefox and Safari. I thought I would try to get in working in IE. My attempt is here: http://theamazing.onlinewebshop.net/light/ Unfortunately, the transparent window is not enclosing the mouse position when the mouse is over the image. Also, the transparent window is jumping around.
10
5469
by: Glich | last post by:
hi, how can I, control mouse position and clicking from python? I want to interact with a flash application inside firefox. thanks. ps: I am not using windows.
5
4844
by: Zaxxon21 | last post by:
I'm basically trying to implement a simple drop down menu list for a button that I have. When the user hovers over the button, I want a list of button options to appear below the button. If the users mouse leaves the button, or the buttons in the list I want the list to disappear. I originally tried to place all of the drop down buttons into a single user control, and to then have them appear when users enter some button and disappear when...
0
8395
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
8310
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,...
0
8826
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
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
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7330
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...
1
6166
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4155
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...
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.