beautypg.com

Test the behavior, The behaviors api functions, Applybehavior() – Adobe Extending Dreamweaver CS4 User Manual

Page 245

background image

239

EXTENDING DREAMWEAVER CS4

Behaviors

10

Click OK.

Dreamweaver adds the specified JavaScript to the whichbrowser.htm file, so that the file appears as follows:

"http://www.w3.org/TR/html4/loose.dtd">



Which browser





Test the behavior

1

View the file whichbrowser.htm in your browser.

2

Depending on which browser you are using, either iecontent.htm or netscapecontent.htm appears.

The behaviors API functions

Two behaviors API functions are required (

applyBehavior()

and

behaviorFunction()

); the rest are optional.

applyBehavior()

Description
This function inserts into the user’s document an event handler that calls the function that

behaviorFunction()

inserts. The

applyBehavior()

function can also perform other edits on the user’s document, but it must not delete

the object to which the behavior is being applied or the object that receives the action.

When you write the

applyBehavior()

function, you must decide how you want to edit the user's document. For

example, you might decide to insert some code inside script tags in the body of the document. You would do this using
the standard DOM editing APIs.

Arguments
uniqueName

This manual is related to the following products: