473,668 Members | 2,482 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

New event listeners without disturbing old?

I try to develope a bookmarklet, which hopefully can be activated on almost
any http-page (i.e. from any server).
The page can have unknown event handlers.
The bookmarklet wants to add its own event handlers for the page without
unnecessarily disturbing the original ones.

The problem resembles the onload-event handling: if there is already one how
to add another so that both handllers can do their work? ( this problem can
be solved , but in this case this is not the problem.

When playing with the FORK-framework some events could work without
disturbing each other, but some other events obviously did not: if e.g.
there was originally defined a 'click'-handler for the body and the
bookmarklet defined its own for the same event, the original might stop
working.

Is there an easy way to solve this problem generally, without knowing how
the original events are handled?

The problem is more or less fun and hobby, not to be taken very seriously.
Hopefully this would be fun for you too :).
Aug 21 '08 #1
3 1101
optimistx meinte:
Is there an easy way to solve this problem generally, without knowing how
the original events are handled?
What's wrong with addEventListene r/attachEvent?

Gregor
--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Aug 21 '08 #2
Gregor Kofler wrote:
optimistx meinte:
>Is there an easy way to solve this problem generally, without
knowing how the original events are handled?

What's wrong with addEventListene r/attachEvent?

Gregor
Good question! Nothing is wrong with them, but are they supposed not to
prevent previously defined ('original') events from being handled? Might be
that in my hasty preliminary tests some other things were disturbing the
situation. (Also an embarrassinging error happened: I had two event handling
functions on the same page with the same name... no wonder one of them
stopped working.)
This situation is like loading several different frameworks to the same
page and hoping everyone of them would continue behaving nicely.
Aug 22 '08 #3
optimistx meinte:
Gregor Kofler wrote:
>What's wrong with addEventListene r/attachEvent?
Good question! Nothing is wrong with them, but are they supposed not to
prevent previously defined ('original') events from being handled?
The *events* are always the same. And those methods are there, that
several *listeners* can peacefully co-exist.
This situation is like loading several different frameworks to the same
page and hoping everyone of them would continue behaving nicely.
Depends on the frameworks. But "normally" they can be combined without
too many problems. At least as fas as event listening goes.

Gregor
--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Aug 22 '08 #4

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

Similar topics

6
2326
by: Amir Hardon | last post by:
I am dynamically adding rows to a table, and each row have a button which removes it. I have successfully implemented this for mozilla but I'm having troubles with IE, here is how I did it: Each new row's id is an index number, each button's name is the row's id, and I'm adding this function as the click event listener for the button: function removeline(event){ var row=document.getElementById("row" + event.target.name);
2
11357
by: kj | last post by:
How does one trigger an event programmatically? I'm interested in how to do this in both the "Level 0" event model as well as in the DOM Level 2 event model. Thanks! kj -- NOTE: In my address everything before the first period is backwards; and the last period, and everything after it, should be discarded.
17
4870
by: abs | last post by:
My element: <span onclick="alert('test')" id="mySpan">test</span> Let's say that I don't know what is in this span's onclick event. Is it possible to add another action to this element's onclick event ? I've tried something like this: oncl = document.getElementById('mySpan').onclick oncl = oncl + '\n;alert(\'added\')' document.getElementById('mySpan').onclick = oncl
29
15527
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ---Start of test.aspx---- <%@ Page language="C#" AutoEventWireup="false" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD>
0
2070
by: Kamilche | last post by:
''' event.py An event manager using publish/subscribe, and weakrefs. Any function can publish any event without registering it first, and any object can register interest in any event, even if it doesn't exist yet. The event manager uses weakrefs, so lists of listeners won't stop them
1
3453
by: Marek Murin | last post by:
Hi all, I have created vb.net user control that has to be used by vb6 form. Everything goes well with putting the vb.net user control on the VB6 form until I want to receive any event from my control. The event handler is displayed on VB6 IDE combo and you can create a sub for it as usual, but when I run the vb6 form to test it, it won't work. I have spent too much time til now with that without finding solution. Can anybody help me ?
0
5003
by: Eniac | last post by:
Hello, I've started using Enterprise Library 2.0 recently and I've encountered a problem that seems to be ... well... undocumented :) Basically, when I set a Trace Listener (formatted event log to be precise), if i specify the name of a custom event log, the listener won't log in it. I've checked in the registry, the log is there. In the event viewer, I
6
3398
by: JeffDotNet | last post by:
Writing to a registered source in the Application event log I have an asp.net framework 2.0 app that I created on a winxp machine and now I am deploying it to IIS6 on a win server2003 machine. This application has to write to the application event log. After deployment of the application I have verified that my source “MySource†exists in the Application event log. I then wrote some text to the event source in a forms app and...
2
1974
by: meyousikmann | last post by:
This will be difficult to explain so bear with me. If anyone is familiar with Tibco Rendezvous and/or Microsoft Messaging, this may make more sense. I've created a hierarchy of objects that looks something like this: Tibco-->Transports-->Transport Where Tibco is the overall component that owns a collection of Transports and each Transport is an object of a class.
0
8790
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 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...
1
8572
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
7391
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
6206
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
5677
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
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2782
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
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.