MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Dokumentacja Strona 210

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 504
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 209
210 Menus and Menu Commands
Returns
Dreamweaver expects an array that contains an even number of elements. The first element is
a string that contains the label for the topmost button. The second element is a string of
JavaScript code that defines the behavior of the topmost button when it is clicked.
The remaining elements define additional buttons in the same manner.
Example
The following example of the commandButtons() function defines the OK, Cancel, and Help
buttons:
function commandButtons(){
return new Array("OK" , "doCommand()" , "Cancel" , ¬
"window.close()" , "Help" , "showHelp()");
}
getDynamicContent()
Description
Retrieves the content for the dynamic portion of the menu.
Arguments
menuID
The menuID argument is the value of the id attribute in the menuitem tag that is
associated with the item.
Returns
Dreamweaver expects an array of strings where each string contains the name of a menu item
and its unique ID, separated by a semicolon. If the function returns a
null value, the menu
does not change.
Example
The following example of the getDynamicContent() function returns an array of four menu
items (My Menu Item 1, My Menu Item 2, My Menu Item 3, and My Menu Item 4):
function getDynamicContent(){
var stringArray= new Array();
var i=0;
var numItems = 4;
for (i=0; i<numItems;i++)
stringArray[i] = new String("My Menu Item " + i + ";¬
id=’My-MenuItem" + i + “‘”);
return stringArray;
}
Przeglądanie stron 209
1 2 ... 205 206 207 208 209 210 211 212 213 214 215 ... 503 504

Komentarze do niniejszej Instrukcji

Brak uwag