beautypg.com

Dreamweaver.popupaction(), Dreamweaver.behaviorinspector.getbehaviorat() – Adobe Dreamweaver API Reference CS5 User Manual

Page 320

background image

315

DREAMWEAVER API REFERENCE

Page content

Last updated 8/27/2013

Example
If you write an action that can be applied only to a hypertext link (

A HREF

), you can use the

getBehaviorTag()

function, as the following example shows, in the function that initializes the user interface for the Parameters dialog box:

function initializeUI(){

var theTag = dreamweaver.getBehaviorTag().toUpperCase();
var CANBEAPPLIED = (theTag.indexOf('HREF') != -1));
if (CANBEAPPLIED) {

// display the action UI

} else{

// display a helpful message that tells the user
// that this action can only be applied to a
// hyperlink

}

}

dreamweaver.popupAction()

Availability
Dreamweaver 2, and updated in CS4.

Description
Starts a Parameters dialog box for the specified behavior action. To the user, the effect is the same as selecting the action
from the Actions pop-up menu in the Behaviors panel. This function lets extension files other than actions attach
behaviors to objects in the document of the user. It blocks other edits until the user dismisses the dialog box.

Note: This function can be called within the

objectTag()

function or in any script in a command file or in the Property

inspector file.

Arguments

actionName

,

{funcCall}

The

actionName

argument is a string that contains the name of a file in the Configuration/Behaviors/Actions

folder. The file contains a JavaScript behavior action (for example, "

Swap Image.htm

").

The

funcCall

argument, which is optional, is a string that contains a function call for the action that is specified

in

actionName

; for example, "

MM_SwapImage(...)

". The

applyBehavior()

function in the action file supplies

this argument, if specified.

Returns
The function call for the behavior action. When the user clicks OK in the Parameters dialog box, the behavior is added
to the current document. The appropriate functions are added to the

HEAD

section of the document. HTML is added

to the top of the

BODY

section, and other edits can be made to the document. The function call (for example,

"

MM_SwapImage(...)

") is not added to document, but becomes the return value of this function.

dreamweaver.behaviorInspector.getBehaviorAt()

Availability
Dreamweaver 3.