473,465 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Simulating an event

Anyone know how to trigger event listeners bound to an element using DOM
level 2 addEventListener or IE's attachEvent?

It's easy with DOM level 0 where the listener is an element attribute
just to call the function from test code (element.onclick() for
example), but not for registered listeners.

--
Ian Collins.
Mar 31 '07 #1
2 1270
On Apr 1, 8:48 am, Ian Collins <ian-n...@hotmail.comwrote:
Anyone know how to trigger event listeners bound to an element using DOM
level 2 addEventListener or IE's attachEvent?
Try dispatchEvent, some examples:

<URL:
http://groups.google.com.au/group/co...cea9cdf065a524
>
<URL: http://developer.mozilla.org/en/docs....dispatchEvent >
IE doesn't support it, but you might be able to similuate it with its
proprietary fireEvent method:

<URL: http://msdn2.microsoft.com/en-us/library/dd6edt33.aspx >

It's easy with DOM level 0 where the listener is an element attribute
just to call the function from test code (element.onclick() for
example), but not for registered listeners.
I'm not sure that qualifies as "DOM 0", it seems to be a consequence
of using the call operator with an object property, which is plain
javascript to me. DOM 0 is something quite different:

<URL: http://developer.mozilla.org/en/docs/Category:DOM_0 >
--
Rob

Apr 1 '07 #2
RobG wrote:
On Apr 1, 8:48 am, Ian Collins <ian-n...@hotmail.comwrote:
>>Anyone know how to trigger event listeners bound to an element using DOM
level 2 addEventListener or IE's attachEvent?

Try dispatchEvent, some examples:

IE doesn't support it, but you might be able to similuate it with its
proprietary fireEvent method:

<URL: http://msdn2.microsoft.com/en-us/library/dd6edt33.aspx >
Thanks, I'll check that out.
>
>>It's easy with DOM level 0 where the listener is an element attribute
just to call the function from test code (element.onclick() for
example), but not for registered listeners.

I'm not sure that qualifies as "DOM 0", it seems to be a consequence
of using the call operator with an object property, which is plain
javascript to me. DOM 0 is something quite different:
I was using the term for basic event handling through element attributes

--
Ian Collins.
Apr 1 '07 #3

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

Similar topics

47
by: Lauren Quantrell | last post by:
I have constructed the following code that simulates the common rollover effect when moving the mouse over a label (this example makes the label bold.) I'm wondering if anyone has come up with...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
8
by: John Dann | last post by:
I've either completely forgotten how to do this or it's different in VB.Net from VB6, but how do I call the routine for a menu click programmatically? (ie I want to simulate and call...
0
by: Rusty | last post by:
I'm using a third party tree view control on my web app. I have built a web control that is used throughout the application. When a user clicks on a node in the tree, the nodes click event is...
4
by: Roger Withnell | last post by:
I would like to freeze column and row headings on a webpage, simulating freeze panes as in an Excel spreadsheet. Don't seem to be able to do it with Frames. Is there a way with Javascript...
7
by: daveyand | last post by:
Is there a way in javascript to trigger the clicking of the left mouse button. Basically i have a floating div that is translucent (40% opacity) this div covers the whole screen. when a user...
2
by: martial | last post by:
HI EVERYONE: i'm trying to simulate the following program which is the implementation of a m/m/2/k queue system, and i've got some errors.Could someone help me to solve this problem? the...
15
by: Bjoern Schliessmann | last post by:
Hello all, I'm trying to simulate simple electric logic (asynchronous) circuits. By "simple" I mean that I only want to know if I have "current" or "no current" (it's quite digital) and the only...
2
by: Affan | last post by:
Hi, I am writing a discrete event simulator and want to simplify the analysis of multipath by trigging an arrival of multipath based on a the receiver distance from sender- say 'd'- and a...
5
by: Xu, Qian | last post by:
Hello All, I have some problem by simulating a link click using javascript. The webpage uses a js-library named interface (jQuery like) ------------------------------ <a id="foo" href="#">Try...
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
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...
1
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,...
0
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...
0
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...
0
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 ...

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.