The dreamweaver dom, Objects, properties, And methods of the dreamweaver dom – Adobe Extending Dreamweaver CS4 User Manual
Page 102
96
EXTENDING DREAMWEAVER CS4
The Dreamweaver Document Object Model
If you are familiar with JavaScript in browsers, you can reference objects in the active document by writing
document
.
(for example,
document.forms[0]
). In Dreamweaver,
document
refers to the extension file;
document.forms[0]
refers to the first form in the extension UI. To reference objects in the user’s document, you must call
dw.getDocumentDOM()
,
dw.createDocument()
, or another function that returns a user document object.
For example, to refer to the first image in the active document, you can write
dw.getDocumentDOM().images[0]
.
You can also store the document object in a variable and use that variable in future references, as shown in the
following example:
var dom = dw.getDocumentDOM(); //get the dom of the current document
var firstImg = dom.images[0];
firstImg.src = "myImages.gif";
This kind of notation is common in files throughout the Configuration folder, especially in command files. For more
information about the
dw.getDocumentDOM()
method, see the
dreamweaver.getDocumentDOM()
function in the
Dreamweaver API Reference.
The Dreamweaver DOM
The Dreamweaver DOM contains a subset of objects, properties, and methods from the World Wide Web Consortium
(W3C) DOM Level 1 specification, which are combined with some properties of the Microsoft Internet Explorer 4.0 DOM.
Objects, properties, and methods of the Dreamweaver DOM
The following table lists the objects, properties, methods, and events that the Dreamweaver DOM supports. Some
properties are read-only when they are accessed as properties of a specific object. A bullet (•) indicates properties that
are read-only when they are used in the listed context.