beautypg.com

Writing the javascript code – Adobe Extending Dreamweaver CS4 User Manual

Page 139

background image

133

EXTENDING DREAMWEAVER CS4

Commands



Make Uppercase or Lowercase








3

Save the file as Change Case.htm in the Configuration/Commands folder.

The contents of the

Title

tag,

Make Uppercase or Lowercase

, appears in the top bar of the dialog box. Within the

form, a table with two cells controls the layout of the elements. Within the table cells are the two options, Uppercase
and Lowercase. The Uppercase option has the

checked

attribute, making it the default selection and ensuring that the

user selects one of the two options or cancels the command.

The form looks like the following figure:

The

commandButtons()

function supplies the OK and Cancel buttons that let the user submit the choice or cancel the

operation. For more information, see

commandButtons()

” on page 138.

Writing the JavaScript code

The following example consists of two extension API functions,

canAcceptCommand()

and

commandButtons()

,

which Dreamweaver calls, and one user-defined function,

changeCase()

, which is called from the

commandButtons()

function.

In this example, you will write JavaScript to perform the following tasks:

This manual is related to the following products: