DOM-Nodes

DOM-Nodes


One,

DOM Node associated with some things as follows:

parentNode、childNodes[nodenumber]、firstChild、lastChild、previousSibling、nextSibling;

In addition there are many such appendChild (), removeChild (), firstChild, nextSibling, previousSibling, parentNode

But also with the methods and properties related to the operation Node


    
    


    
 
 
div1

p1

p2

p3

Div2

p21

p22

p23

div3

p31

p32

p33

Follows

Depending childNodes index, the position may be known as

Two, nodeValue property

nodeValue property can take text nodes, attribute nodes, but to get any element nodes.

Note that node childNodes [0], childNodes [1] belongs text nodes, attributes of an application so as nodeValue

Three, nodeName property

1, nodeName attribute is read-only.

2, an element node nodeName is the tag name

3, an attribute node's nodeName is the attribute name

4, a text node's nodeName always expressed as #text

5, a document of nodeName always expressed as #document

Four, nodeType property

If it is, then the nodeType element will be represented as 1, attribute the nodeType compared with 2,

The text was nodeType 3, comment of nodeType was 8, document, compared with the 9 nodeType.

Fifth, the difference document.body and document.documentElement

Original: Big Box  DOM-Nodes


Guess you like

Origin www.cnblogs.com/chinatrump/p/11491066.html