removeBehavior method
Removes the specified behavior from the current element.
Syntax:
You can find the related objects in the Supported by objects section below.
Parameters:
Required. Specifies the identifier returned by the addBehavior method. |
Return value:
Boolean. One of the following values:
Cannot remove the behavior. | |
The remove operation was successful. |
Example HTML code 1:
This example shows how to add and remove behaviors:
|
|||||
<head> <script type="text/javascript"> var behaviorIDs = []; var divElems = []; function SetBehaviors () { divElems = document.getElementsByTagName ("div"); for (i=0; i < divElems.length; i++) { if (divElems[i].addBehavior) { behaviorIDs[i] = divElems[i].addBehavior ("hover.htc"); } } } function RemoveBehaviors () { for (i=0; i < divElems.length; i++) { if (divElems[i].removeBehavior) { divElems[i].removeBehavior (behaviorIDs [i]); } } } </script> </head> <body> You can add behaviors to the div elements with this button: <button onclick="SetBehaviors ();">Add behaviors!</button> <br /><br /> Hover your mouse over the div elements! <br /><br /> Use this button to remove behaviors: <button onclick="RemoveBehaviors ();">Remove behaviors!</button> <br /><br /> <div>1. division</div> <div>2. division</div> <div>3. division</div> </body> |
|||||
|
|||||
Did you find this example helpful?
|
Supported by objects:
CommentNode
HTML elements:
a, abbr, acronym, address, applet, area, b, base, basefont, bdo, bgsound, big, blockquote, body, br, button, caption, center, cite, code, col, colgroup, comment, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, frame, frameset, h1, h2, h3, h4, h5, h6, head, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:hidden, input:image, input:password, input:radio, input:reset, input:submit, input:text, ins, isindex, kbd, label, legend, li, link, listing, map, marquee, menu, meta, nobr, noframes, noscript, object, ol, optgroup, option, p, param, plaintext, pre, q, rt, ruby, s, samp, script, select, small, span, strike, strong, style, sub, sup, table, tbody, td, textarea, tfoot, th, thead, title, tr, tt, u, ul, var, wbr, xml, xmp
Related pages:
External links:
User Contributed Comments