Adobe 38040334 - Dreamweaver CS3 User Manual page 171

Extending dreamweaver
Hide thumbs Also See for 38040334 - Dreamweaver CS3:
Table of Contents

Advertisement

The
attribute causes Dreamweaver to display Document Title in a tooltip box when the user places the
tooltip
mouse pointer over the text box. The
specifies that the EditTitle.htm file contains the JavaScript functions that operate on the text box. To see the full
definition of the Dreamweaver Document toolbar, see the main toolbar (
toolbars.xml file.
Writing the JavaScript code
When the user interacts with the text box, it causes Dreamweaver to invoke the EditTitle.htm command file in the
Toolbars/MM folder. This file contains three JavaScript functions that operate on the Title text box. These functions
are
canAcceptCommand()
canAcceptCommand(): enable the toolbar item
The
canAcceptCommand()
Document Object Model (DOM) and whether the document is parsed as HTML. The function returns the results
of those tests. If the conditions are
returns the value
, Dreamweaver disables the item.
false
The function is as follows:
function canAcceptCommand()
{
return (dw.getDocumentDOM() != null && dw.getDocumentDOM().getParseMode() == 'html');
}
receiveArguments(): set the title
Dreamweaver invokes the
value in the Title text box and presses the Enter key or moves the focus away from the control.
The function is as follows:
function receiveArguments(newTitle)
{
var dom = dw.getDocumentDOM();
if (dom)
dom.setTitle(newTitle);
}
Dreamweaver passes
newTitle
function first checks to see whether a current DOM exists. If it does, the
receiveArguments()
function sets the new document title by passing
ments()
getCurrentValue(): get the title
Whenever an update cycle occurs, as determined by the default update frequency of the
Dreamweaver calls the
getCurrentValue()
update frequency of the
onEdit
update attribute.
For the Title text box, the following
interface (API) function
dom.getTitle()
The function is as follows:
attribute specifies the size of the field in pixels. The
width
,
, and
receiveArguments()
function consists of one line of code that checks to see whether there is a current
, Dreamweaver enables the text box item on the toolbar. If the function
true
function, shown in the following example, when the user enters a
receiveArguments()
, which is the value that the user enters, to the
function to determine what value to display for the control. The default
handler determines the update frequency because the Title text edit control has no
getCurrentValue()
to obtain and return the current title.
id="DW_Toolbar_Main"
.
getCurrentValue()
receiveArguments()
to the
newTitle
dom.setTitle()
function calls the JavaScript application programming
DREAMWEAVER CS3
Extending Dreamweaver
attribute
file
) in the
function. The
receiveArgu-
function.
event handler,
onEdit
165

Advertisement

Table of Contents
loading

This manual is also suitable for:

Dreamweaver cs3

Table of Contents