473,699 Members | 2,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mouse events within a DIV layer and Netscape/Mozilla

I am trying to capture mouse events when entering and leaving a DIV
layer. This test code works fine with IE 6.0 and Opera 7.21 but fails
with Mozilla/Netscape. The strange thing is that the mouse events
respond continuously whenever the mouse is moving inside the DIV area.

Does anybody have a clue about what is happenning ?

J2G
==== TEST CODE ====

<html>
<head>
<script type=text/javascript>
function show() {
nbIn=0;
nbOut=0;
document.getEle mentById('AREA' ).style.visibil ity = 'visible';
}

function areaIn() {
nbIn++;
window.status = "out: " + nbOut + " in: " + nbIn;
}

function areaOut() {
nbOut++;
window.status = "out: " + nbOut + " in: " + nbIn;
}

</script>
</head>
<body>

<a href="javascrip t:show()">SHOW DIV</a>
<p>

<div id="AREA" size=5 style="visibili ty: hidden"
onmouseover="ja vascript:areaIn ()" onmouseout="jav ascript:areaOut ()">
<select size=5>
<option>value 01
<option>value 02
<option>value 03
<option>value 04
<option>value 05
<option>value 06
</select>
</div>

</body>
</html>
Jul 20 '05 #1
1 9764


Jean-Gael GRICOURT wrote:
I am trying to capture mouse events when entering and leaving a DIV
layer. This test code works fine with IE 6.0 and Opera 7.21 but fails
with Mozilla/Netscape. The strange thing is that the mouse events
respond continuously whenever the mouse is moving inside the DIV area.

Does anybody have a clue about what is happenning ?
Yes, the events mouseout/mouseover fire whenever the mouse moves
over/out any element, your div has a child element, the <select>, which
has child elements, the <option> elements, and when you move your mouse
over the select element then mouseout for the <div> is fired and
mouseover for the <select>. And events bubble, so any events happening
on the <select> or the <option> bubble up to the <div> and fire your
onmouseover/onmouseout handler. See
http://www.faqts.com/knowledge_base/...d/1606/fid/145
for a solution.
<div id="AREA" size=5 style="visibili ty: hidden"
onmouseover="ja vascript:areaIn ()" onmouseout="jav ascript:areaOut ()">
<select size=5>
<option>value 01
<option>value 02
<option>value 03
<option>value 04
<option>value 05
<option>value 06
</select>
</div>


--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

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

Similar topics

2
4644
by: Jawahar Rajan | last post by:
All, I have a printer friendly page that is opened when a user clicks a link on my page to get the printer friendly version, How ever when they close out the printer friendly version and return to the original page the mouse cursor is a Hour glass shape! my code: I use DIV tag <DIV id ="printThis"> <%
7
3963
by: Eqbal Z | last post by:
Hi, I have the following code, and onmouseover/onmouseout etc. does not work in netscape 4.7. <div id="divUpControl"><a href="javascript:void(0);" onMouseOver="PerformScroll(-7);" onMouseOut="CeaseScroll();" class="nounderline"></a><a href="javascript:void(0);" onMouseOver="PerformScroll(7);" onMouseOut="CeaseScroll();" class="nounderline"></a></div>
9
22750
by: punkin | last post by:
I am trying to catch mouse position on the entire screen by dynamically generating mouse click event at every 100 ms. My code only works for IEs but not any Netscape or Gecko-based browsers. The following are the problems and I hope that there is someone who can enlighten me or give me some pointers. Also, my testing code is attached at the end. And please don't ask me why I am doing this - it is one of functional requirements by all...
2
2058
by: Catherine Lynn Smith | last post by:
I have been playing with a page design that would use a 'circular' area in the middle rather than the standard boring square box world of tables and frames. I have the design itself layed out using a couple of 'div' layers including transparent gifs in 'higher' zIndex layers to create the circular 'window' to the lower layers. But now I am learning that although I can see the HTML on the lower layer, the transparent gif layer above it...
7
6537
by: Larry R Harrison Jr | last post by:
I am looking for javascript and a basic tutorial on how to make mouse-over drop-down menus--the type that when you "hover" over a subject links relevant to that subject "emerge" which you can then "hover" over and click. (see the links left on http://www.dpreview.com to see what I mean) I have code from smartwebby.com (DHTML) but I'm not sure if it's the best, and I'm not sure how to integrate any menus of my own into it. The code...
4
1916
by: Jonas | last post by:
Hi! I have a web page where I want to intercept keypress events in an INPUT-tag and check if it is the Enter key, which calls another function that executes a search. My code runs on Netscape 7 for Windows, IE 6 for Windows and IE5.1 for Mac, but not on Netscape 7 for Mac. When I press the Enter key, the event gets caught but it does not get prevented and the search is never executed. The code looks like this:
10
18072
by: Danny | last post by:
How can I get the coordinates of the mouse cursor in Mozilla browsers as well as Opera and IE6? I'm struggling to understand how to capture mouse movement events with Mozilla/Netscape/Firefox and I've Googled so much my brain hurts. http://www.ghpkendal.co.uk/TestPages/Test.htm Move your cursor over the yellow area and you should see the mouse coordinates echoed above.
4
14722
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.
3
6463
by: Nick Wedd | last post by:
I have this <DIV id="canopy" onClick="myhandler(event.x,event.y); return false;"> <IMG border=0 height=66 width=292 src="gifs/top.gif"> </DIV> which works in IE. myhandler gets called with the coordinates of where the mouse was clicked relative to the <HTML>, and I know where my DIV is, so I can calculate which part of the image was clicked on. But with Mozilla, I can't use event.x and event.y, only event.screenX and event.screenY. ...
0
8620
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
9180
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
8920
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
8887
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
7755
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
6536
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
5877
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
4378
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
2351
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.