Adobe Extending Dreamweaver CS4 Manuel d'utilisateur Page 247

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 387
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 246
241
EXTENDING DREAMWEAVER CS4
Behaviors
Returns
Dreamweaver expects either a string that contains the JavaScript functions or a string that contains the names of the
functions to be inserted in the user’s document. This value must be exactly the same every time (it cannot depend on
user input). The functions are inserted only once, regardless of how many times the action is applied to elements in
the document.
Note: Quotation marks ("")within the returned string must be preceded by a backslash (\) escape character to avoid
errors that the JavaScript interpreter reports.
Example
The following instance of the behaviorFunction() function returns the MM_popupMsg() function:
function behaviorFunction(){
return ""+
"function MM_popupMsg(theMsg) { //v1.0\n"+
"alert(theMsg);\n"+
"}";
}
The following example is equivalent to the preceding behaviorFunction() declaration and is the method used to
declare the
behaviorFunction() function in all behaviors that come with Dreamweaver:
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 true value if the action is allowed but has no preferred events.
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 234.
A false value if the action is not allowed.
If the canAcceptBehavior() function returns a false value, the action is dimmed in the Actions pop-up menu
on the Behaviors panel.
Vue de la page 246
1 2 ... 242 243 244 245 246 247 248 249 250 251 252 ... 386 387

Commentaires sur ces manuels

Pas de commentaire