[This documentation is preliminary and is subject to change.]
Sets or retrieves the location of the Dynamic HTML (DHTML) behavior.
Integer value = object.put_behavior(BSTR v);Integer value = object.get_behavior(BSTR* sBehavior);
Script implementation of a DHTML behavior, where
sLocation is an absolute or relative URL.
The application's default behavior, identified by its
url(sLocation) | url(#objID) | url(#default#behaviorName)
|Applies To||All elements|
You can apply multiple behaviors to an element by specifying a space-delimited list of URLs for the -ms-behavior attribute, as shown in the following syntax:
<element style="behavior:url(a1.htc) url(a2.htc) ..." >
In the following section, one example demonstrates how you can apply two behaviors to an element to achieve a combination of effects. Conflicts resulting from applying multiple behaviors to an element are resolved based on the order in which the behavior is applied to the element. Each succeeding behavior takes precedence over the previous behavior. For example, if multiple behaviors set the element's color, the prevailing color is the one set by the behavior last applied to the element. The same rule applies in resolving name conflicts, such as with property, method, or event names exposed by multiple behaviors.
Once the -ms-behavior property is defined for the element, the addBehavior method can be used to dynamically attach additional behaviors to the element.
Note A behavior attached to an element by using the addBehavior method or by applying the proposed Cascading Style Sheets (CSS) -ms-behavior attribute inline is not automatically detached from the element when the element is removed from the document hierarchy. However, a behavior attached using a style rule defined in the document is detached automatically as the element is removed from the document tree.
Windows Internet Explorer 8. The -ms-behavior attribute is an extension to CSS, and can be used as a synonym for behavior in IE8 Standards mode.
Minimum supported client
Minimum supported server
|Windows Server 2003|
Using DHTML Behaviors
Build date: 1/23/2012