MACROMEDIA DREAMWEAVER MX 2004-EXTENDING DREAMWEAVER Spezifikationen Seite 173

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 504
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 172
A simple command example 173
Linking functions to the OK and Cancel buttons
When the user clicks OK or Cancel, the extension needs to perform the appropriate action.
You determine the appropriate action by specifying which JavaScript function to perform
when either button is clicked.
To link the OK and Cancel button to functions:
1. Open the file Change Case.js in the Configuration/Commands folder.
2. At the end of the file, add the following code:
function commandButtons() {
return new Array("OK", "changeCase()", "Cancel", "window.close()");
}
3.
Save the file.
The
commandButtons() function causes Dreamweaver to supply the OK and Cancel buttons
and tells Dreamweaver what to do when the user clicks them. The
commandButtons()
function tells Dreamweaver to call
changeCase() when the user clicks OK and to call
window.close() when the user clicks Cancel.
Letting the user specify uppercase or lowercase
When the user clicks a menu item, the extension needs a mechanism to let the user select
uppercase or lowercase. The UI provides this mechanism by defining two radio buttons to let
the user make that choice.
To let the user specify uppercase or lowercase:
1. Open the file Change Case.js.
2. At the end of the file, add the following code:
function changeCase() {
var uorl;
// Check whether user requested uppercase or lowercase.
if (document.forms[0].elements[0].checked)
uorl = 'u';
else
uorl = 'l';
// Get the DOM.
var theDOM = dw.getDocumentDOM();
// Get the outerHTML of the HTML tag (the
// entire contents of the document).
var theDocEl = theDOM.documentElement;
var theWholeDoc = theDocEl.outerHTML;
Seitenansicht 172
1 2 ... 168 169 170 171 172 173 174 175 176 177 178 ... 503 504

Kommentare zu diesen Handbüchern

Keine Kommentare