inspectBehavior()

Description

This function 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 the inspectBehavior() function is not defined, the default option values appear.

NOTE

The inspectBehavior() function 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.

    NOTE

    If the HTML element contains code that is similar to 'onClick="someBehavior(); return document.MM_returnValue;"', and you add a new behavior from the behavior menu, Adobe Dreamweaver calls inspectBehavior() as soon as the new behavior UI pops up, and passes an empty string as the parameter. Consequently, be sure to check the applyBehaviorString parameter, as shown in the following example:

function inspectBehavior(enteredStr){ if(enteredStr){ //do your work here }}

Returns

Adobe Dreamweaver expects nothing.

Example

The following instance of the inspectBehavior() function, taken from the Display Status Message.htm file, fills in the Message field in the Parameters dialog box with the message that the user selected when the behavior was originally applied:

function inspectBehavior(msgStr){ var startStr = msgStr.indexOf("'") + 1; var endStr = msgStr.lastIndexOf("'"); if (startStr > 0 && endStr > startStr) { document.theForm.message.value = ¬ unescQuotes(msgStr.substring(startStr,endStr)); }}

NOTE

For more information about the unescQuotes() function, see the dwscripts.js file in the Configuration/Shared/Common/Scripts/CMN folder.