
100
EXTENDING DREAMWEAVER CS4
The Dreamweaver Document Object Model
Property or method Return value
nodeType • Node.DOCUMENT_NODE
parentNode • null
parentWindow • The JavaScript object that corresponds to the
document’s parent window. (This property is defined in
the Microsoft Internet Explorer 4.0 DOM, but is not part
of DOM Level 1 or 2.)
childNodes • A NodeList that contains all the immediate children of
the
document object. Typically the document has a
single child, the
HTML object.
previousSibling • null
nextSibling • null
documentElement • The JavaScript object that corresponds to the html tag.
This property is shorthand for getting the value of
document.childNodes and extracting the HTML tag
from the
NodeList.
body • The JavaScript object that corresponds to the body tag.
This property is shorthand for calling
document.documentElement.childNodes and
extracting the
body tag from the NodeList. For
frameset documents, this property returns the node for
the outermost frameset.
URL • The file://URL for the document or, if the file has not
been saved, an empty string.
getElementsByTagName(tagName) A NodeList that can be used to step through tags of
type
tagName (for example, img, div, and so on).
If the tagName argument is “LAYER”, the function
returns all
LAYER and ILAYER tags and all absolutely
positioned elements.
If the tagName argument is “INPUT”, the function
returns all form elements. (If a name attribute is
specified for one or more
tagName objects, it must
begin with a letter, which the HTML 4.01 specification
requires, or the length of the array that this function
returns is incorrect.)
getElementsById(Id) Gets the element node with the specified id. Where id
is a string containing the ID of the element to get.
var dom = dw.getDocumentDOM(); var contObj
= dom.getElementById('content');
alert("The element with the id 'content'
is a " + contObj.tagName);
getElementsByAttributeName(attrName) A NodeList that can be used to step through elements
with an attribute
attrName (for example, all elements
with the attribute "for"). Not part of DOM Level 1 or 2.
getElementById(id) The HTML element with the specified ID.
hasChildNodes() true
Komentarze do niniejszej Instrukcji