84 Part (Web server application) III . Document Objects Reference Table

84 Part III . Document Objects Reference Table 14-5 Properties of Selected Nodes for a Simple HTML Document Properties Nodes document HTML P one and only nodeType 9 1 1 3 nodeName #document HTML P #text nodeValue null null null one and only parentNode null document BODY EM previousSibling null null null null nextSibling null null null null childNodes HTML HEAD This is the (none) BODY EM paragraph on the page. firstChild HTML HEAD This is the null lastChild HTML BODY paragraph on null the page. The nodeType property is an integer that is helpful in scripts that iterate through an unknown collection of nodes. Most content in an HTML document is of type 1 (HTML element) or 3 (text fragment), with the outermost container, the document, of type 9. A node s nodeName property is either the name of the node s tag (for an HTML element) or a constant value (preceded by a # [hash mark] as shown in Table 14-3). And, what may surprise some, the nodeValueproperty is null except for the text fragment node type, in which case the value is the actual string of text of the node. In other words, for HTML elements, the W3C DOM does not expose a container s HTML as a string. It is doubtful that you will use all of the relationship-oriented properties of a node, primarily because there is some overlap in how you can reach a particular node from any other. The parentNode property is important because it is a reference to the current node s immediate container. While the firstChild and lastChild properties point directly to the first and last children inside a container, most scripts generally use the childNodes property with array notation inside a for loop to iterate through child nodes. If there are no child nodes, then the childNodes array has a length of zero.
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply