Adobe 38040334 - Dreamweaver CS3 User Manual page 244

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

The following example is equivalent to the preceding
declare the
behaviorFunction()
_
function MM
popupMsg(theMsg){ //v1.0
alert(theMsg);
}
function behaviorFunction(){
_
return "MM
popupMsg";
}
canAcceptBehavior()
Description
This function determines whether the action is allowed for the selected HTML element and specifies the default
event that should trigger the action. Can also check for the existence of certain objects (such as SWF files) in the
user's document and not allow the action if these objects do not appear.
Arguments
HTMLElement
The argument is the selected HTML element.
Returns
Dreamweaver expects one of the following values:
• A
value if the action is allowed but has no preferred events.
true
• A list of preferred events (in descending order of preference) for this action. Specifying preferred events overrides
the default event (as denoted with an asterisk [*] in the Event file) for the selected object. See step 1 in "How
Behaviors work" on page 231.
• A
value if the action is not allowed.
false
If the
canAcceptBehavior()
the Behaviors panel.
Example
The following instance of the
the document has any named images:
function canAcceptBehavior(){
var theDOM = dreamweaver.getDocumentDOM();
// Get an array of all images in the document
var allImages = theDOM.getElementsByTagName('IMG');
if (allImages.length > 0){
return "onMouseOver, onClick, onMouseDown";
}else{
return false;
}
}
behaviorFunction()
function in all behaviors that come with Dreamweaver:
function returns a
value, the action is dimmed in the Actions pop-up menu on
false
function returns a list of preferred events for the behavior if
canAcceptBehavior()
Extending Dreamweaver
declaration and is the method used to
DREAMWEAVER CS3
238

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents