Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
detachEvent
Collapse the table of content
Expand the table of content

detachEvent method

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

Syntax


HRESULT retVal = object.detachEvent(event, function);

Parameters

event [in]

Type: BSTR

BSTR that specifies any of the standard DHTML Events.

function [in]

Type: object

Pointer to an IDispatch interface that specifies the function previously set using the IHTMLWindow3::attachEvent method.

Return value

Type: HRESULT

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

Standards information

There are no standards that apply here.

Remarks

Behaviors that attach to events using the IHTMLWindow3::attachEvent method must explicitly call the IHTMLWindow3::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 IHTMLWindow3::detachEvent method.

See also

Reference
IHTMLWindow3::attachEvent
Conceptual
Introduction to DHTML Behaviors
Using DHTML Behaviors
Using HTML Components to Implement DHTML Behaviors in Script

 

 

Community Additions

ADD
Show:
© 2015 Microsoft