detachEvent Method (IHTMLElement2)

Switch View :
ScriptFree
IHTMLElement2::detachEvent Method

Unbinds the specified function from the event, so that the function stops receiving notifications when the event fires.

Syntax


HRESULT detachEvent(
    BSTR event,
    IDispatch *pDisp
);

Parameters

event
[in] BSTR that specifies any of the standard DHTML Events.
pDisp
[in] Pointer to an IDispatch interface that specifies the function previously set using the IHTMLElement2::attachEvent method.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

Behaviors that attach to events using the IHTMLElement2::attachEvent method must explicitly call the IHTMLElement2::detachEvent method to stop receiving notifications from the page when the ondetach event fires. Behaviors that attach to events using the PUBLIC:ATTACH element automatically stop receiving notifications when the behavior detaches from the element, and thus do not need to call the IHTMLElement2::detachEvent method.

See Also