Behavior functions
371
Description
Gets the DOM object that corresponds to the tag to which the behavior is being applied. This
function is applicable only in Behavior action files.
Arguments
None.
Returns
A DOM object or a
null
value. This function returns a
null
value 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
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]
}
}
000_DW_API_Print.book Page 371 Wednesday, July 20, 2005 11:58 AM
Summary of Contents for DREAMWEAVER 8-DREAMWEAVER API
Page 1: ...Dreamweaver API Reference...
Page 16: ......
Page 28: ...28 The File I O API...
Page 38: ...38 The HTTP API...
Page 68: ...68 Flash Integration...
Page 100: ...100 The Database API...
Page 116: ...116 The JavaBeans API...
Page 144: ...144 The Source Control Integration API...
Page 146: ......
Page 254: ...254 Workspace...
Page 298: ...298 Site...
Page 354: ...354 Document...
Page 396: ...396 Page Content...
Page 488: ...488 Design...
Page 550: ...550 Code...