Javascript Reference
Categories: Node

javascript Node addEventListener( )

@April 6, 2010, 5:26 p.m.
addEventListener( ) Firefox/Netscape/NN 6 IE n/a Chrome/Safari/DOM 2  

addEventListener("eventType", listenerFunction, useCapture)

  

Binds an event handler function to the current node so that the function executes when an event of a particular type arrives at the node either as event target or during event propagation. Note that W3C DOM events propagate through text nodes, as well as element nodes. The node listens for the event type either during event capture or event bubbling propagation, depending upon the setting of the Boolean third parameter. You may invoke this method multiple times for the same node but with different parameter values to assign as many event handling behaviors as you like, but only one listener function may be invoked for the same event and propagation type. If the event listener is added on a temporary basis, it may be removed via the removeEventListener( ) method.

 
Parameters
 
  • 1st parameter: A string of one event type (without the "on" prefix) known to the browser's object model. The W3C DOM knows the following event types (and Netscape 6 implements most of them):
  • "click","mouseover" ... view all on**** events

  • 2nd parameter:  A reference to the function to execute when the node hears the event type in the specified propagation mode. As this is a reference to a function object, do not surround the name in quotes, nor include the parentheses of the function. At execution time, the browser automatically passes the current event object as a parameter to the listener function.
  • 3rd parameter: A Boolean value. If true, the node listens for the event type only while the event propagates toward the target node (in event capture node). If false, the node listens only when the event bubbles outward from the event target. If the current node is the target of the event, either Boolean value may be used.
 
Returned Value

None.

<a href=https://gcialisk.com/>cheapest cialis[/url]
jephaph - 3 years
[url=https://vsviagrav.com/]viagra[/url]
havoity - 3 years
Under moderation.
Timothyrax - 2018-02-14

Powered by Linode.