It is important to distinguish between the DOM of the user’s document and the DOM of the extension. The information in this topic applies to both types of Dreamweaver documents, but the way that you reference each DOM is different.
For example, to refer to the first image in the active document, you can write dw.getDocumentDOM().images. 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; firstImg.src = “myImages.gif”;