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();
NO
TE
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
Summary of Contents for DREAMWEAVER 8-DREAMWEAVER API
Page 1: ...Dreamweaver API Reference...
Page 16: ......
Page 28: ...28 The File I O API...
Page 38: ...38 The HTTP API...
Page 68: ...68 Flash Integration...
Page 100: ...100 The Database API...
Page 116: ...116 The JavaBeans API...
Page 144: ...144 The Source Control Integration API...
Page 146: ......
Page 254: ...254 Workspace...
Page 298: ...298 Site...
Page 354: ...354 Document...
Page 396: ...396 Page Content...
Page 488: ...488 Design...
Page 550: ...550 Code...