beautypg.com

Inserting multiple functions in the user’s file, Handling actions that require return value, A simple behavior example – Adobe Extending Dreamweaver CS4 User Manual

Page 241

background image

235

EXTENDING DREAMWEAVER CS4

Behaviors

4

Dreamweaver displays a dialog box that contains the

BODY

elements of the Action file. If the Action file’s

body

tag

contains an

onLoad

handler, Dreamweaver executes it.

5

The user fills in the parameters for the action. Dreamweaver executes event handlers that are associated with the
form fields as the user encounters them.

6

The user clicks OK.

7

Dreamweaver calls the

behaviorFunction()

and

applyBehavior()

functions in the selected Action file. These

functions return strings that are inserted into the user’s document.

8

If the user later double-clicks the action in the Actions column, Dreamweaver reopens the Parameters dialog box
and executes the

onLoad

handler. Dreamweaver then calls the

inspectBehavior()

function in the selected Action

file, which fills in the fields with the data that the user previously entered.

Inserting multiple functions in the user’s file

Actions can insert multiple functions—the main behavior function plus any number of helper functions—into the
head section. Two or more behaviors can even share helper functions as long as the function definition is exactly the
same in each Action file. One way of ensuring that shared functions are identical is to store each helper function in an
external JavaScript file and insert it into the appropriate Action files using