Compartir a través de


attachEvent method

Binds the specified function to an event, so that the function is called whenever the event fires on the object.

Syntax

HRESULT retVal = object.attachEvent(event, pDisp, pfResult);

Parameters

event [in]

Type: BSTR

BSTR that specifies any of the MSHTML Event DispInterfaces.

pDisp [in]

Type: IDispatch

Pointer to an IDispatch interface that specifies an object to be called whenever event fires.

pfResult [out, retval]

Type: VARIANT_BOOL

Pointer to a VARIANT_BOOL that receives one of the following values:

VARIANT_TRUE

Function did bind successfully to the event

VARIANT_FALSE

Function did not bind successfully to the event.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

See also

Reference

IHTMLNamespace::detachEvent

Conceptual

Introduction to DHTML Behaviors

Introduction to Viewlink

About Element Behaviors