473,412 Members | 5,385 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,412 software developers and data experts.

please explain this "simple" mouseover behavior... bubbling?

This has surely been answered somewhere multiple times, but...
I'm guessing it's some sort of "bubbling" thing....

<STYLE>
..triggerarea {
border:#00C solid 1px;
}
</STYLE>

<UL ID="menu">
<LI class="triggerarea" onmouseover="alert('triggered');">Here's nested
list...
<UL>
<LI>Why does mousing over each individual</LI>
<LI>list item trigger the event?</LI>
<LI>I only want/expect it to be triggered</LI>
<LI>by the "container" LIs </LI>
<LI>(which I've put a blue border around)</LI>
<LI class="triggerarea" onmouseover="alert('triggered');">another
nested list
<UL>
<LI>again, every LI is triggering</LI>
<LI>not just the container</LI>
</UL>
</LI>
<LI><A HREF="#">A Link</A></LI>
<LI>Nothing to see here</LI>
</UL>
</LI>
<LI>this item shouldn't and doesn't do anything</LI>
</UL>

Dec 21 '05 #1
3 3310
VK

BKDotCom wrote:
This has surely been answered somewhere multiple times, but...
I'm guessing it's some sort of "bubbling" thing....


You are right with both of your guessings :-)
<http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/083ed9630b81dee9/cd81fab7ffdfadd7#cd81fab7ffdfadd7>

btw: there is nothing "simple" in this problem. That is one of these
"simple" things which leaves hell's doors loose.
Another "simple" question of such kind is for instance "how to know the
exact position of element on the page".

Dec 21 '05 #2
BKDotCom wrote:
This has surely been answered somewhere multiple times, but...
I'm guessing it's some sort of "bubbling" thing....


Yes. It's not simple but it's not too hard once you get your head
around the solution. There is no need to wade through the thread posted
by VK (but do so if you want to bone-up on inter-poster rivalry).

Read (and follow the "next" links):

<URL:http://www.quirksmode.org/js/introevents.html>
[...]

--
Rob
Dec 22 '05 #3
> Why does mousing over each individual list item trigger the event?

Because when you move your mouse towards to another element (even if
it's inside the <ul>), you're firing the <ul>'s mouseout...

But due to event bubbling, when you're over the <li>, the <ul>
mouseover is fired again...

I only want/expect it to be triggered by the "container" LIs


You still can achieve this objective, but the possible solutions that I
see are ugly, since you'll have to control where the mouse is in a
sort of manually way ;]

Maybe this can be useful:
http://www.mozilla.org/docs/dom/domr...ent_ref20.html
--
"Invente, Tente!!! Faça um código eficiente" (eu)

Jonas Raoni Soares Silva
---------------------------
jonasraoni at gmail dot com
http://www.jsfromhell.com

Dec 22 '05 #4

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

Similar topics

1
by: Mark Creelman | last post by:
Hello all: I am attempting to use a database program that I downloaded from http://www.thescripts.com/serversidescripting/perl/tutorials/asimpledatabaseprogram/database.txt with good...
1
by: Dario de Judicibus | last post by:
I wish to create two simple layouts by using only HTML, CSS and the minimum JavaScript as possible. Layouts should be "elastic" (no fixed widths and heights) and cross-browser enabled. The first...
1
by: Ray Watson | last post by:
Hi all I thought there might be an easy way to have a separate label or picture on web page change as the cursor passes over different buttons on the same web form. In access I could use the "on...
2
by: mantas44 | last post by:
Hello all, I have two tables tab_a id(int) tab_b id(int)
2
by: Axel Dahmen | last post by:
Hi, I'd like to write a simple COM Automation Server in C# but couldn't find a matching project. I want to have the IDE maintain the IDL and the REG file automatically. Which project should I...
8
by: Beam_Us_Up_Scotty | last post by:
Hello all, I am trying to write a "simple" animation using C#, and I've tried many things but nothing seems to work for me without leaking memory. Here's a very simple piece of code that uses a...
6
by: JPSutor | last post by:
Does anyone have an example of a simple FTP trasfer app? All I need to do is transfer one file up to a web site and then retrieve it again. Every example I run into is loaded with code that, to...
23
by: Sacred Heart | last post by:
Hi, I'm new to Python and have come across a problem I don't know how to solve, enter com.lang.python :) I'm writing some small apps to learn the language, and I like it a lot so far. My...
2
by: fordie1000 | last post by:
Hi, Although I have been programming in python for years ... I rarely use classes .... just functions etc. .... anyway I was wondering if there is someone who could give me a simple way of...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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...
0
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,...

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.