Specifications
Chapter 31382
Arguments
None.
Returns
A DOM object or null. This function returns null under the following circumstances:
• When the current script is not executing within the context of the Behaviors panel
• When the Behaviors panel is being used to edit a behavior in a timeline
• When the currently executing script is invoked by dreamweaver.popupAction()
• When the Behaviors panel is attaching an event to a link wrapper and the link wrapper does
not yet exist
• When this function appears outside of an action file
Example
dreamweaver.getBehaviorElement() can be used in the same way as
“dreamweaver.getBehaviorTag()” on page 382 to determine whether the selected action is
appropriate for the selected HTML tag, except that it gives you access to more information about
the tag and its attributes. For example, if you write an action that can be applied only to a
hypertext link (
A HREF) that does not target another frame or window, you can use
getBehaviorElement() as part of the function that initializes the user interface for the
Parameters dialog box.
function initializeUI(){
var theTag = dreamweaver.getBehaviorElement();
var CANBEAPPLIED = (theTag.tagName == "A" && ¬
theTag.getAttribute("HREF") != null && ¬
theTag.getAttribute("TARGET") == null);
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 without an explicit target]
}
}
dreamweaver.getBehaviorTag()
Availability
Dreamweaver 1.2
Description
Gets the source of the tag to which the behavior is being applied. This function is applicable only
in action files.
Arguments
None.
Returns
A string that represents the source of the tag. This is the same string that passes as an argument
(
HTMLelement) to the canAcceptBehavior() function. If this function appears outside an action
file, the return value is an empty string.