User Guide
312 Document
Examples
The following example uses the dreamweaver.getDocumentDOM() function to access the
current document:
var theDOM = dreamweaver.getDocumentDOM("document");
In the following example, the current document DOM identifies a selection and pastes it at
the end of another document:
var currentDOM = dreamweaver.getDocumentDOM('document');
currentDOM.setSelection(100,200);
currentDOM.clipCopy();
var otherDOM = dreamweaver.openDocument(dreamweaver.¬
getSiteRoot() + "html/foo.htm");
otherDOM.endOfDocument();
otherDOM.clipPaste();
dreamweaver.getNewDocumentDOM()
Availability
Dreamweaver MX; added documentType argument in Dreamweaver 8.
Description
Provides access to the editable tree for a new, empty document. This function works in the
same way as the
getDocumetDOM() function, except that it points to a new document, not an
existing one, and does not open the document.
Arguments
{documentType}
■ The documentType argument is a string. Its value must be a document type specified in
the DocumentTypes.xml file.
Returns
A pointer to a new, empty document.
Example
The following code returns the DOM for a new, empty document:
var theDOM = dreamweaver.getNewDocumentDOM();
NOTE
The openDocument() argument is used because DOM methods normally operate only on
open documents. Running a function on a document that isn’t open causes a
Dreamweaver error. The DOM methods that can operate only on the active document or
on closed documents indicate this fact in their descriptions.
000_DW_API_Print.book Page 312 Wednesday, July 20, 2005 11:58 AM