DOM-related knowledge (2)

Neck destination, DOM manner node类型friendly content currency and:
Node.ELEMENT_NODE (1)
Node.ATTRIBUTE_NODE (2)
Node.TEXT_NODE (3)
Node.CDATA_SECTION_NODE (4)
Node.ENTITY_REFERENCE_NODE (5)
Node.ENTITY_NODE (6)
Node.PROCESSING_INSTRUCTION_NODE ( 7)
Node.COMMENT_NODE (8)
Node.DOCUMENT_NODE (9)
Node.DOCUMENT_TYPE_NODE (10)
Node.DOCUMENT_FRAGMENT_NODE (11)
Node.NOTATION_NODE (12)

Document type is nodeType: (9)

document object is a property of the window object, so as to access a global object can
Document node has two built-in shortcuts to access child nodes first is documentElement property, the second is childNodes list to access the document element, since the first a property always point <html> element, faster and more direct and easier to use

Therefore documentElement is pointing to <html>, as well as document.body points to the <body>
all browsers support more than two properties
there document.title, document.URL, document.domain and document.referrer

Commonly used methods:
getElementById (),
getElementsByTagName (), getElementsByTagName ( "*"), this method will select all labels
getElementsByName (),

Released two original articles · won praise 0 · Views 12

Guess you like

Origin blog.csdn.net/Edasi/article/details/104255988