Javascript Reference
Categories: Element

javascript Element attachEvent( )

@March 15, 2008, 1:22 a.m.
attachEvent( )Firefox/Netscape/NN n/a IE 5(Win) Chrome/Safari/DOM n/a  

attachEvent("eventName", functionReference)

  

Binds an event handler function to an element object for a particular event type. Similar in operation to the W3C DOM addEventListener( ) method, the IE attachEvent( ) method is used primarily for IE behaviors. Binding events through element object event handler properties is a better cross-browser approach for regular HTML pages. If you bind an event handler through the attachEvent( ) method, you can disengage the binding via the detachEvent( ) method.

 
Parameters
 
  • String version of the event name, including the "on" prefix. Applicable event types include any event from IE/Windows extensive list of shared event types shown later in this section. Although not case-sensitive, all-lowercase values are recommended.
  • A reference to the function to execute when the element receives the event either as the event target or through event propagation. As this is a reference to a function object, do not surround the name in quotes, nor include the parentheses of the function. No parameters may be passed to the function.
 
Returned Value

Boolean value true if the binding is successful.

Amazon Relational Database Service (<a href=https://aws.amazon.com/rds/>RDS</a>)
KathleenReat - 2 years

Powered by Linode.