Click to return to the Reusing Browser Technology home page    
IHTMLElement2 Interface     IHTMLElement2::addFilter ...     IHTMLElement2 Interface    
Web Workshop  |  Reusing Browser Technology

IHTMLElement2::addBehavior Method


Adds the specified behavior to the list of behaviors influencing this element.

Syntax

HRESULT addBehavior(
   BSTR bstrUrl,
   VARIANT *pvarFactory,
   long *pBehaviorID
);

Parameters

bstrUrl
String (BSTR) variable that specifies the URL for the behavior to be added to the element.
pvarFactory
Address of a VARIANT structure to an ElementBehaviorFactory interface for the behavior.
pBehaviorID
Address of a long pointer returning the new behavior's ID.

Return Value

Returns S_OK if successful, or an error code otherwise.

Remarks

Behaviors are subject to cross-frame security rules where a web page may not refer to a behavior on another server, or another domain. In this case, the addBehavior method returns E_ACCESSDENIED. For more information, see the Security section in the DHTML Behaviors article.

See Also

removeBehavior


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? Write us!

© 1999 Microsoft Corporation. All rights reserved. Terms of use.