473,394 Members | 1,674 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,394 software developers and data experts.

mouse events

Hello,

I want to create a pop up when I hover over a div layer. This works perfectly fine until I add another layer inside it.

Here is an example of the code:
[html]
<div style="height: 300px; border: 1px solid;" onmouseover="alert('over')" onmouseout="alert('out')">
<div style="position: absolute; left: 200px; height: 200px; width: 100px; border: 1px solid green"></div>
</div>
[/html]

Basically the problem is when my mouse hovers over the small div layer inside the big layer an alert will come out indicating it is out of the big div layer, and then another popup indicates that it is back in.

What I want is for that alert to pop up only when I'm out of the big div layer.

I've tried using zindexes but it doesn't do anything...

Thanks in advance
Feb 15 '07 #1
3 1360
dorinbogdan
839 Expert 512MB
For IExplorer, use "onmouseenter" and "onmouseleave" events, or write a event handler function and set window.event.cancelBubble = true.

For other browsers call event.stopPropagation() method inside the event handler function.
Feb 16 '07 #2
acoder
16,027 Expert Mod 8TB
See this page for more info.
Feb 16 '07 #3
Well, thats easy, you need to add the function to both divs...
think if it like an image.

you have a square image
--------
|Your|
|Box |
--------
Now you ad another one inside it
---------
| --- |
| --- |
----------

Then you put your mouse over the inner box. Now technically it is over both images, but visually its not.
Thats how it works
What you could do though, if your too lazy, put an invisible div over it, however, the downside is that the user would not be able to touch anything under it.

<div style="position: absolute; left: (X Coord)px; top: (Y Coord)px; width: (width of area to cover)px; height: (height of area to cover)px;" (functional data)>(nothing goes here.)</div>

Then you input the coords that it is over your object.

Well, good luck, i hoped it helped, and sorry about the horrific grammar. i wasn't planning to write a book on it. :P
Oct 25 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: John Champaign | last post by:
Hi all, I'm working on an educational applet for a child with special needs. He's got a bit of a trick to make my life more difficult... To interact with the applet he needs to click on...
0
by: Stephen Williams | last post by:
I am migrating a VB 6 PictureBox control to VB.NET. In VB 6, this control modified its border style during the mouse down and up events to provide user feedback that it was selected. Once...
1
by: Jean-Gael GRICOURT | last post by:
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...
3
by: red | last post by:
mouse events when the mouse is on a "child control" hi everyone; my problem: I have a userControl in this usercontrol, I have a child control (a button) when the mouse moves over the...
5
by: Bill Henning | last post by:
Does anyone know a good method of preventing keyboard and mouse events from interrupting processing? My situation is: 1) I need to track and handle all key and mouse events 2) I need to perform...
3
by: Rick Strahl [MVP] | last post by:
I'm working on an app that's using the WebBrowser control. I got the control working fine, hooking to the document object. But I've run into a major issue with hooking the Document events....
3
by: Charles Law | last post by:
In a user control, is it possible to replace the default mouse events with my own? In particular, I want the consumer of my control to get MouseMove events when the mouse is over my control, so...
2
by: bretth | last post by:
In a VB.Net Windows Forms application, I have a user control that handles mouse events. Another section of code programmatically adds a label to the control. I would like label to ignore all...
5
by: Adeel | last post by:
Hi group! I'm trying to learn C# on my own... I'd appreciate it very much if someone can help me out here. I have a basic form without any controls on it... I want to catch mouse clicks (both...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.