baseUrl Property (IHTMLDo...       IHTMLDocument3      
 
Web Workshop  |  Reusing Browser Technology 
 IHTMLDocument3::attachEvent Method--------------------------------------------------------------------------------Binds the specified function to an event, so that the function gets called whenever the event fires on the object.SyntaxHRESULT attachEvent(
    BSTR event,
    IDispatch *pDisp,
    VARIANT_BOOL *pfResult
);
Parametersevent
[in] BSTR that specifies any of the standard DHTML Events.
pDisp
[in] Pointer to an IDispatch  interface that specifies the function to call when event fires.
pfResult
[out, retval] Pointer to a VARIANT_BOOL that receives one of the following possible values:
VARIANT_TRUE
The function was bound successfully to the event.
VARIANT_FALSE
The function was not bound to the event.
Return ValueReturns S_OK if successful, or an error value otherwise. 
ResWhen event fires on the object, the object's event handler is called before pDisp, the specified function. If you attach multiple functions to the same event on the same object, the functions are called in random order, immediately after the object's event handler is called.The IHTMLDocument3::attachEvent method enables a behavior to handle events that occur on the containing page. This method is not limited, however, to behaviors. You can also define a function on a page that attaches to events fired on the same page.Behaviors that attach to events using the IHTMLDocument3::attachEvent method must explicitly call the IHTMLDocument3::detachEvent method to stop receiving notifications from the page when the ondetach event fires.Method InformationStock Implementation mshtml.dll 
Custom Implementation No 
Minimum availability Internet Explorer 5.0 
Minimum operating systems Windows 95, Windows NT 4.0 See AlsoIHTMLDocument3::detachEvent, DHTML Behaviors, Using DHTML Behaviors, Implementing DHTML Behaviors in Script Using HTML Components
Back to top  
Did you find this topic useful? Suggestions for other topics? Write us!  
© 2000 Microsoft Corporation. All rights reserved. Terms of use.