User Guide
306 Chapter 15: Page Content
Example
The dreamweaver.getBehaviorElement() function can be used in the same way as
dreamweaver.getBehaviorTag() 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. As shown in the following 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 the
getBehaviorElement() function 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.getBehaviorEvent() (deprecated)
Availability
Dreamweaver 1.2; deprecated in Dreamweaver 2 because actions are now selected before events.
Description
In a Behavior action file, this function gets the event that triggers this action.
Arguments
None.
Returns
A string that represents the event. This is the same string that is passed as an argument (event) to
the
canAcceptBehavior() function.
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.
000_DW_API_Print.book Page 306 Wednesday, August 20, 2003 9:14 AM