HTML and CSS Reference
node is the <html> tag, called the root node of the document. Below it are the <head>
and <body> tags, which are called child nodes of the HTML element. In the <title> is the
text My Title, which is also a node, called a text node . Because it is the last node, the
tree-like structure terminates at that node, also called a leaf node . The nodes are divided
into three types of nodes: the element node , attribute node , and the text node . These
types are numbered 1, 2, and 3, for element, attribute, and text node, respectively. In the
example, the <p> and <h1> tags are element nodes, title=“para1” is an attribute node, and
the text between the <title> tags, My Title , is an example of a text node. An attribute node
is represented as a property of the HTML element to which it is assigned; for example,
the <a> tag has an href attribute. In the example, <a href=“http://www.prenhall.com”> , a
is an element node, href is an attribute node and the URL is called its nodeValue . (The
text nodes are not supported on all browsers.)
Refer to Tables 15.2 and 15.3 for a list of node properties and node methods.
<body> (last child )
<head> (first child)
Figure 15.3 A tree of nodes.
Table 15.2 Node Properties
What It Does
Returns the first child node of an element.
Returns the last child node of an element.
Returns the next child node of an element at the same level as the current child node.