Specifications
To o l b a r s 101
The file attribute in this text box item causes Dreamweaver to invoke the Toolbars/MM/
EditTitle.htm command file when the user interacts with the text box.
<html>
<head>
<title>Edit Title</title>
<script language="JavaScript">
function receiveArguments(newTitle)
{
var dom = dw.getDocumentDOM();
if (dom)
dom.setTitle(newTitle);
}
function canAcceptCommand()
{
return (dw.getDocumentDOM() != null && dw.getDocumentDOM().getParseMode() ==
’html’);
}
function getCurrentValue()
{
var title = "";
var dom = dw.getDocumentDOM();
if (dom)
title = dom.getTitle();
return title;
}
</script>
</head>
<body>
</body>
</html>
For the Document Title text box, the getCurrentValue() function calls the JavaScript API
function
dom.getTitle() to obtain and return the current title. Until the user enters a title for
the document, the
getCurrentValue() function returns “Untitled Document,” which
Dreamweaver displays in the text box. After the user enters a title, Dreamweaver displays the new
document title.
Dreamweaver invokes the
receiveArguments() function when the user enters a value in the
Document Title text box and presses the Enter key or moves the focus away from the control.
Dreamweaver passes
receiveArguments() newTitle, which is the value that the user enters.
The
receiveArguments() function first checks to see if a current DOM exists. If it does,
receiveArguments() sets the new document title by passing it to the dom.setTitle() function
and then returning it to Dreamweaver
.