★ wanayoo — archive 1999 http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/removebehavior.aspNouvelle recherche | Portail wanayoo
MSDN Online Web Workshop   All Products  |   Support  |   Search  |   microsoft.com Home  
microsoft.com Home
  Home  |   Magazines  |   Libraries  |   Developer Centers  |   Resources  |   Downloads  |   Search MSDN
 
removeAttribute Method     removeChild Method     DHTML Methods    
Web Workshop  |  DHTML, HTML & CSS

removeBehavior Method


Detaches a behavior from the element.

Syntax

bSuccess = object.removeBehavior(iID)

Parameters

iID Required. Integer that specifies the identifier returned from a previous addBehavior call.

Return Value

Boolean. Returns true if the behavior was removed successfully, or false otherwise.

Example

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.

Sample Code

<SCRIPT LANGUAGE="JScript">
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.
:
This feature requires Microsoft® Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

A, ACRONYM, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BGSOUND, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, COMMENT, custom, DD, DEL, DFN, DIR, DIV, DL, DT, EM, EMBED, FIELDSET, FONT, FORM, FRAME, FRAMESET, HEAD, Hn, HR, HTML, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, ISINDEX, KBD, LABEL, LEGEND, LI, LINK, LISTING, MAP, MARQUEE, MENU, NEXTID, NOBR, NOFRAMES, NOSCRIPT, OBJECT, OL, OPTION, P, 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

See Also

addBehavior, DHTML Behaviors, Using DHTML Behaviors, Implementing DHTML Behaviors in Script