The DOMNode interface supports the following properties:
attributes | |
Access | Read-only |
Type | DOMNamedNodeMap |
Description | A DOMNamedNodeMap of DOMAttr objects corresponding to the attributes that are set for this node. Returns null if the current node is not a DOMElement. |
Usage | |
JScript | DOMNode_object.attributes; |
VBScript | DOMNode_object.attributes |
Example |
// SoftQuad Script Language JSCRIPT: var elem=ActiveDocument.documentElement; var attrs = elem.attributes; //get number of attributes set on this element Application.Alert(attrs.length); |
childNodes | |
Access | Read-only |
Type | DOMNodeList |
Description | A DOMNodeList that contains all children of this node. |
Usage | |
JScript | DOMNode_object.childNodes; |
VBScript | DOMNode_object.childNodes |
Example |
// SoftQuad Script Language JSCRIPT: var children=ActiveDocument.documentElement.childNodes; Application.Alert(children.length); |
firstChild | |
Access | Read-only |
Type | DOMNode |
Description | The first child of the node. If there is no such node, null is returned. |
Usage | |
JScript | DOMNode_object.firstChild; |
VBScript | DOMNode_object.firstChild |
Example |
// SoftQuad Script Language JSCRIPT: var parent = ActiveDocument.documentElement; Application.Alert(parent.firstChild.nodeName); |
lastChild | |
Access | Read-only |
Type | DOMNode |
Description | The last child of the node. If there is no such node, null is returned. |
Usage | |
JScript | DOMNode_object.lastChild; |
VBScript | DOMNode_object.lastChild |
Example |
// SoftQuad Script Language JSCRIPT: var parent = ActiveDocument.documentElement; Application.Alert(parent.lastChild.nodeName); |
nextSibling | |
Access | Read-only |
Type | DOMNode |
Description | The node immediately following this node. If there is no such node, null is returned. |
Usage | |
JScript | DOMNode_object.nextSibling; |
VBScript | DOMNode_object.nextSibling |
Example |
// SoftQuad Script Language JSCRIPT: var parent = ActiveDocument.documentElement; var child = parent.firstChild; Application.Alert(child.nextSibling.nodeName); |
nodeName | |
Access | Read-only |
Type | String |
Description |
The name of this node. Will return different names depending on what type of node it is.
The DOM Level 1 specification details the node names for each type of
node:
|
Usage | |
JScript | DOMNode_object.nodeName; |
VBScript | DOMNode_object.nodeName |
Example |
// SoftQuad Script Language JSCRIPT: var nd = Selection.ContainerNode; Application.Alert(nd.nodeName); |
nodeType | |
Access | Read-only |
Type | Integer |
Description | An integer representing the type of the underlying object. The allowed values are specified by the DOM Level 1 specification: |
Usage | |
JScript | DOMNode_object.nodeType; |
VBScript | DOMNode_object.nodeType |
Example |
// SoftQuad Script Language JSCRIPT: var elem=ActiveDocument.documentElement; var child=elem.firstChild; Application.Alert(child.nodeType); |
nodeValue | |
Access | Read/write |
Type | String |
Description |
The value of the node. The DOM Level 1 specification details which
types of nodes have values, and where the values come from:
|
Usage | |
JScript | DOMNode_object.nodeValue; |
VBScript | DOMNode_object.nodeValue |
Example |
// SoftQuad Script Language JSCRIPT: var elem=ActiveDocument.documentElement; var attrs = elem.attributes; //get the value of the first attribute Application.Alert(attrs.item(0).nodeValue); |
ownerDocument | |
Access | Read-only |
Type | Document |
Description | The Document object associated with this node. If the current node is a Document object, this property is null. |
Usage. | |
JScript | DOMNode_object.ownerDocument; |
VBScript | DOMNode_object.ownerDocument |
Example |
// SoftQuad Script Language JSCRIPT: var nd = Selection.ContainerNode; var doc = nd.ownerDocument; Application.Alert(doc.doctype.name); |
parentNode | |
Access | Read-only |
Type | DOMNode |
Description | The parent of this node. If a parent node does not exist, this property is null. |
Usage | |
JScript | DOMNode_object.parentNode; |
VBScript | DOMNode_object.parentNode |
Example |
// SoftQuad Script Language JSCRIPT: var nd = Selection.ContainerNode; var parent = nd.parentNode; Application.Alert(parent.nodeName); |
previousSibling | |
Access | Read-only |
Type | DOMNode |
Description | The node immediately preceding this node. If there is no such node, this property is null. |
Usage | |
JScript | DOMNode_object.previousSibling; |
VBScript | DOMNode_object.previousSibling; |
Example |
// SoftQuad Script Language JSCRIPT: var parent = ActiveDocument.documentElement; var child = parent.lastChild; Application.Alert(child.previousSibling.nodeName); |
Copyright © SoftQuad Software Inc. 1999