To PointedEars with my deep respect.
Author ;-)
There were a question a while ago about events. Now I see that my
original explanation was not full. Check this sample out:
<html>
<head>
<title>Event test</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script>
function test1() {
alert('MouseOut event detected');
}
function test2() {
if (window.event.t oElement.tagNam e=='BODY') {
alert('MouseOut event detected');
}
}
</script>
<style type="text/css">
<!--
/* this to prevent ul's to take
the whole page width
so you could slip your mouse from the right */
ul { width: 10%}
-->
</style>
</head>
<body bgcolor="#FFFFF F">
<h4>Test Case 1</h4>
<ul onmouseout="tes t1()">
<li><a href="bogus1.ht ml">Item 1</a></li>
<li><a href="bogus2.ht ml">Item 2</a></li>
<li><a href="bogus3.ht ml">Item 3</a></li>
</ul>
<h4>Test Case 2</h4>
<ul onmouseout="tes t2()">
<li><a href="bogus1.ht ml">Item 1</a></li>
<li><a href="bogus2.ht ml">Item 2</a></li>
<li><a href="bogus3.ht ml">Item 3</a></li>
</ul>
</body>
</html>
Test Case 1 was made (as I stronly believe) in the way anyone would try
first to capture onMouseOut event from a list (function test1).
Nevertheless this test case doesn't work at all.
First of all, it gets a fountain of events not only from the <ul>, but
from all underlaying elements (<a>'s here) as well.
Secondly, it gets MOUSEOUT event in case of MOUSEOVER event: when mouse
enters to the <ul> area! The last nonsence took a cup of strong coffee
from me before I recalled the implemented "compatibil ity scheme". Now
events are simultaneously "bubbling" from the bottom to the top (IE
scheme) as well as "falling down" from the top to the bottom (broken
parts taken from NN4).
So when I move my mouse OVER the <ul>, I leaving the body area, and
this OUT event received by window (NN top-to-bottom scheme) is being
delivered down to the <ul>. It's getting crazy even reading this, is
not it?
Any way, test2() solves the problem by examining event's property, but
it uses IE proprietary properties.
Any semi-simple universal solution for this case? 3 1372
VK wrote: function test1() { alert('MouseOut event detected'); } function test2() { if (window.event.t oElement.tagNam e=='BODY') { alert('MouseOut event detected'); } }
<ul onmouseout="tes t1()"> <li><a href="bogus1.ht ml">Item 1</a></li> <li><a href="bogus2.ht ml">Item 2</a></li> <li><a href="bogus3.ht ml">Item 3</a></li> </ul> <h4>Test Case 2</h4> <ul onmouseout="tes t2()"> <li><a href="bogus1.ht ml">Item 1</a></li> <li><a href="bogus2.ht ml">Item 2</a></li> <li><a href="bogus3.ht ml">Item 3</a></li> </ul>
Any way, test2() solves the problem by examining event's property, but it uses IE proprietary properties.
Any semi-simple universal solution for this case?
Check out
<http://www.faqts.com/knowledge_base/view.phtml/aid/1606/fid/145>
--
Martin Honnen http://JavaScript.FAQTs.com/
Well, I guess my Nobel prise went to you...
Still I think that your problem description is not totally correct:
<quot>
This means that the problem is not just about bubbling, because when
you mouse the mouse over the link, you are not moving out of anything
contained in the div nor are you moving out of the area contained by
the div. A mouseout event fires simply because a mouseover event fires
for another element.
</quot>
As my preliminary (I'm just 3 days on my vacations :-) experiments have
shown, the problem is in the "compatibil ity mode":
Any event gets cloned, and after that both copies are playing "first
train is going from point A, second train is going from point C". Other
words, one copy goes "NN way" top-to-bottom (window -> deepest
element), other copy goes "IE way" bottom-to-top (deepest element ->
window). If you are trying to capture events somewhere in the point B:
A______________ _B_____________ ______C
then both trains are passing you in both directions leaving you with
big eyes on the platform.
VK wrote: Still I think that your problem description is not totally correct: <quot> This means that the problem is not just about bubbling, because when you mouse the mouse over the link, you are not moving out of anything contained in the div nor are you moving out of the area contained by the div. A mouseout event fires simply because a mouseover event fires for another element. </quot>
If you move the mouse over a child element of a container element then
the mouseout of the container element fires.
As my preliminary (I'm just 3 days on my vacations :-) experiments have shown, the problem is in the "compatibil ity mode": Any event gets cloned, and after that both copies are playing "first train is going from point A, second train is going from point C". Other words, one copy goes "NN way" top-to-bottom (window -> deepest element), other copy goes "IE way" bottom-to-top (deepest element -> window). If you are trying to capture events somewhere in the point B: A______________ _B_____________ ______C
then both trains are passing you in both directions leaving you with big eyes on the platform.
While Netscape 6/7 and Opera 7/8 both implement the W3C DOM Level 2
Events where events do not only bubble up the tree but first move down
the tree any code using HTML event handler attributes e.g.
<element onmouseover=".. ." onmouseout="... "
is only noticing the bubbling phase.
So the problem you experience has nothing to do with the capturing phase
of the W3C DOM events module, it is simply that mouseout/mouseover
always occur in pairs, if you move the mouse over a child then a
mouseout on the container is first fired, then a mouseover on the child.
--
Martin Honnen http://JavaScript.FAQTs.com/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steven Brown |
last post by:
I'm trying to figure out how to safely use .NET events/delegates in a
thread-safe class. There are a couple problems. One is that the standard
"if(EventName != null) EventName(...);" call can fail if the event is
emptied of all methods between the two statements, implying that some sort
of synchronization between this and removals from EventName is needed. The
other problem is that if an event with a set of delegates is in the process...
|
by: knocte |
last post by:
Hello.
I am a web developer very worried about "bloat code" and "languages
mixture". So, since some time, I always try to avoid completely the use
of javascript in XHTML/HTML files. This leads to me to hate, also, any
event (onload, onchange, ...) instanciated in the element tag itself, like:
<input type="text" onkeyup="return doSomething();" />
I would replace this code above with an input element marked with an
|
by: Jon Davis |
last post by:
The garbage handler in the .NET framework is handy. When objects fall out of
scope, they are automatically destroyed, and the programmer doesn't have to
worry about deallocating the memory space for those objects. In fact, all
the programmer has to worry about is the total sum of objects loaded into
RAM at any known point. Memory leaks are not a problem.
.... So one would like to think. The reality is that delegates and event...
|
by: Efim |
last post by:
Hi,
I have got some problem with sending of events in .NET.
I am using remouting.
The client has got 2 objects for receiving different types of events
(responses and events)
The server has got two objects for sending of these events.
The client opens tcp port 0 to receive events:
if (ChannelServices.GetChannel("tcp") == null)
{
|
by: scsharma |
last post by:
Hi,
I am working on creating a webapplication and my design calls for creating
main webform which will have menu bar on left hand side and a IFrame which
will contain all the forms that are shown when menu items are clicked.Besides
these i would like to put a custom status bar. Any error message encountered
in any of the webpage will be displayed in the banner.
The problem iam encountering is how to access the customer status bar in
child...
| |
by: hakan_cn |
last post by:
Hi all!
Sorry for the cross-post, I really have a difficult problem and need
some help badly.
I have a VB6 ActiveX component (dll) that listens to a real-time data
feed of stock quotes (built in an OCX) and then passes them on using
events.
The consumer of these VB6 events is a C# dll using .NET 2.0
|
by: Burkhard |
last post by:
Hi,
I am new to C# (with long year experience in C++) and I am a bit confused by
the language construct of events. What is it I can do with events that I
cannot do with delegates? At the moment it seems to me that Microsoft has
developed similar functionality via two keywords. I do understand that an
event offers better encapsulation as the underlying delegate is private, but
is that all ?
--
Regards
|
by: Paal Berggreen |
last post by:
I am involved with development of a Portal solution using ASP.NET 2.0
and WebParts. The WebParts framework use the default personalization
providers, and the personalization data thus ends up in the aspnetdb
database (which we have placed on a proper SQL Server, not SQL Server
Express).
Everything works like a charm, with the following exception:
New users in the system have to press links or buttons twice upon their
first logon to...
|
by: daan |
last post by:
Hello,
I have a problem and I can't get the solution for it :(
I have a com dll, which i imported as a reference. The com object is
part of a class which is multithreaded and will create seperate objects
which we can and must control. On these com objects I added the events
via AddHandler. This is working great, I can see that my threads are
raising events through the com object.
|
by: hmm |
last post by:
Hi all
I have two problems:
Problem #1:
I'm using a .NET Form with the property 'FormBorderStyle' set to 'None'. The idea is to completely cover the area of that Form with a UserControl. In order to be able to move that Form around with the mouse I have to implement EventHandlers for the MouseDown, MouseUp and MouseMove event.
Now the problem I have is these Events will never be fired because the entire dialog is covered by the...
|
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...
| |
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,...
|
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...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |