Specifications

Chapter 13136
3 Dreamweaver calls the windowDimensions() function, if defined, to determine the
size of the Parameters dialog box. If
windowDimensions() is not defined, the size is
determined automatically.
A dialog box always appears, with OK and Cancel buttons appearing at the right edge,
regardless of the contents of the Body element.
4 Dreamweaver displays a dialog box that contains the BODY elements of the Action file. If the
Action files
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 users 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 functionsthe main behavior function plus any number of helper
functionsinto the
HEAD. 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
<SCRIPT SRC="externalFile.js">.
When the user deletes a behavior, Dreamweaver attempts to remove any unused helper functions
that are associated with the behavior. If other behaviors are using a helper function, it is not
deleted. Because the algorithm for deleting helper functions errs on the side of caution,
Dreamweaver might occasionally leave an unused function in the users document.
The Behaviors API
Two Behaviors API functions are required (applyBehavior() and behaviorFunction()); the
rest are optional.
applyBehavior()
Description
Inserts into the users document an event handler that calls the function that
behaviorFunction() inserts. This function can also perform other edits on the users document,
but it must not delete the object to which the behavior is being applied or the object that receives
the action.
Arguments
uniqueName
The argument is a unique identifier among all instances of all behaviors in the users document.
Its format is
functionNameInteger, where functionName is the name of the function that
behaviorFunction() inserts. This argument is useful if you insert a tag into the users
document and you want to assign a unique value to its
NAME attribute.