removeBehavior method
Detaches a behavior from the element.
Syntax
*object.*removeBehavior(cookie)
Parameters
cookie [in]
Type: IntegerValue that specifies the identifier that is returned from a previous addBehavior call.
Return value
Type: Boolean
Returns one of the following possible values.
Return value | Description |
---|---|
true | The behavior was successfully removed. |
false | The behavior was not removed. |
Standards information
There are no standards that apply here.
Remarks
This method applies only to attached behaviors, which are the original Dynamic HTML (DHTML) behaviors introduced in Microsoft Internet Explorer 5. Element behaviors are a feature in Microsoft Internet Explorer 5.5 and cannot be added or removed from an element.
Examples
This example uses the removeBehavior method to show how a behavior that implements a mouseover highlighting effect can be dynamically removed from all li elements on a page.
Code example: http://samples.msdn.microsoft.com/workshop/samples/components/htc/refs/addBehavior.htm
<script type="text/javascript">
var collBehaviorID = new Array();
var collLI = new Array ();
var countLI = 0;
:
function detachBehavior()
{
for (i=0; i < countLI; i++)
collLI[i].removeBehavior (collBehaviorID [i]);
}
</script>
:
Click <a href="javascript:detachBehavior()">here</a>
to remove highlighting effect.
:
See also
Reference
Conceptual
Introduction to DHTML Behaviors
Using HTML Components to Implement DHTML Behaviors in Script