Specifications
Behaviors 141
A more complex version of identifyBehaviorArguments() is necessary for behavior functions
that have a variable number of arguments (such as Show/Hide Layer). For this version of
identifyBehaviorArguments(), there is a minimum number of arguments, and additional
arguments always come in multiples of the minimum number. In other words, a function
with a minimum number of arguments of 4 may have 4, 8, or 12 arguments, but it cannot
have 10 arguments.
function identifyBehaviorArguments(fnCallStr) {
var listOfArgTypes;
var itemArray = dreamweaver.getTokens(fnCallStr, ’(),’);
// The array of items returned by getTokens() includes the
// function name, so the number of *arguments* in the array
// is the length of the array minus one. Divide by 4 to get the
// number of groups of arguments.
var numArgGroups = ((itemArray.length - 1)/4);
// For each group of arguments
for (i=0; i < numArgGroups; i++){
// Add a comma and "NS4.0ref,IE4.0ref,other,dep" (because this
// hypothetical behavior function has a minimum of four
// arguments the Netscape object reference, the IE object
// reference, a dependent URL, and perhaps a property value
// such as "show" or "hide") to the existing list of argument
// types, or if no list yet exists, add only
// "NS4.0ref,IE4.0ref,other,dep"
var listOfArgTypes += ((listOfArgTypes)?",":"") + ¬
"NS4.0ref,IE4.0ref,other,dep";
}
}
inspectBehavior()
Description
Inspects the function call for a previously applied behavior in the user’s document and sets the
values of the options in the Parameters dialog box accordingly. If
inspectBehavior() is not
defined, the default option values appear.
Note: inspectBehavior() must rely solely on information that the applyBehaviorString argument passes to it.
Do not attempt to obtain other information about the user’s document (for example, using
dreamweaver.getDocumentDOM()) within this function.
Arguments
applyBehaviorString
This argument is the string that the applyBehavior() function returns.
Returns
Dreamweaver expects nothing.