Compartilhar via


removeBehavior method

Detaches a behavior from the element.

Syntax

*object.*removeBehavior(cookie)

Parameters

  • cookie [in]
    Type: Integer

    Value 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

a

abbr

acronym

address

applet

area

article

aside

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

figcaption

figure

font

footer

form

frame

frameSet

head

header

hgroup

hn

hr

html

i

iframe

img

input type=button

input type=checkbox

input type=email

input type=file

input type=hidden

input type=image

input type=number

input type=password

input type=radio

input type=range

input type=reset

input type=search

input type=submit

input type=tel

input type=text

input type=url

ins

isIndex

kbd

label

legend

li

link

listing

map

mark

marquee

menu

nav

nextID

noBR

noFrames

noScript

object

ol

option

p

plainText

pre

q

rt

ruby

s

samp

script

section

select

small

span

strike

strong

style

sub

sup

table

tBody

td

textArea

tFoot

th

tHead

title

tr

tt

u

ul

var

wbr

xml

xmp

Reference

addBehavior

Conceptual

Introduction to DHTML Behaviors

Using DHTML Behaviors

About Element Behaviors

Using HTML Components to Implement DHTML Behaviors in Script