Specifications
Chapter 31380
Behavior functions
Behavior functions let you add behaviors to and remove them from an object, find out which
behaviors are attached to an object, get information about the object to which a behavior is
attached, and so on. Methods of the
dreamweaver.behaviorInspector object either control or
act on the selection in the Behaviors panel, not in the current document.
dom.addBehavior()
Availability
Dreamweaver 3
Description
Adds a new event/action pair to the selected element. This function is valid only for the active
document.
Arguments
event, action, {eventBasedIndex}
• event is the JavaScript event handler that should attach the behavior to the element; for
example,
onClick, onMouseOver, or onLoad.
• action is the function call that applyBehavior() returns if the action is added using the
Behaviors panel; for example,
"MM_popupMsg(’Hello World’)".
• eventBasedIndex is the position at which this action should be added. eventBasedIndex is a
zero-based index; if two actions already are associated with the specified event, and you specify
eventBasedIndex as 1, this action executes between the other two. If you omit this argument,
the action is added after all existing actions for the specified event.
Returns
Nothing.
dom.getBehavior()
Availability
Dreamweaver 3
Description
Gets the action at the specified position within the specified event. This function acts on the
current selection and is valid only for the active document.
Arguments
event, {eventBasedIndex}
• event is the JavaScript event handler through which the action is attached to the element; for
example,
onClick, onMouseOver, or onLoad.
• eventBasedIndex is the position of the action to get. For example, if two actions are
associated with the specified event, 0 is first and 1 is second. If you omit this argument, all the
actions for the specified event return.