MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Specifikace Strana 314

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 504
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 313
314 Behaviors
behaviorFunction()
Description
This function inserts one or more functions—surrounded by the following tags, if they dont
yet exist—into the
HEAD section of the users document:
<SCRIPT LANGUAGE="JavaScript"></SCRIPT>
Arguments
None.
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.
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";
}
NOTE
Quotation marks ("")within the returned string must be preceded by a backslash (\)
escape character to avoid errors that the JavaScript interpreter reports.
Zobrazit stránku 313
1 2 ... 309 310 311 312 313 314 315 316 317 318 319 ... 503 504

Komentáře k této Příručce

Žádné komentáře