
A simple menu command example 197
5. Dreamweaver calls the receiveArguments() function, if defined, in the selected Menu
Commands file to let the command process any arguments that pass from the menu item.
6. Dreamweaver calls the commandButtons() function, if defined, to determine which
buttons appear on the right side of the Options dialog box and what code should execute
when the user clicks the buttons.
7. Dreamweaver scans the Menu Commands file for a FORM tag.
If a form exists, Dreamweaver calls the
windowDimensions() function to determine the
size of the Options dialog box that contains the
BODY elements of the file.
If the
windowDimensions() function is not defined, Dreamweaver automatically sizes the
dialog box.
8. If the Menu Commands file’s BODY tag contains an onLoad handler, Dreamweaver executes
the associated code (whether or not a dialog box appears). If no dialog box appears, the
remaining steps do not occur.
9. The user selects options in the dialog box. Dreamweaver executes event handlers that are
associated with the fields as the user encounters them.
10. The user clicks one of the buttons that are defined by the commandButtons() function.
11. Dreamweaver executes the code that is associated with the clicked button.
12. The dialog box remains visible until one of the scripts in the Menu Commands file calls
the
window.close() function.
A simple menu command example
This simple menu command example shows how Undo and Redo menu commands might
work. The Undo menu command reverses the effect of a user’s editing operation, and the
Redo item reverses an Undo operation and restores the effect of the user’s last editing
operation.
You can implement this example by performing the following steps:
■ Creating the menu commands
■ Writing the JavaScript code
■ Placing the command file in the Menu folder
NOTE
If it is a dynamic menu item, the ID of the menu item passes as the only argument.
Komentáře k této Příručce