Chapter 3 dom
Dom is the abbreviation of "Document Object Model" (Document Object Model.
Node
Element Node: it is the DOM atom. For example, the name of a text paragraph element is the name of the P unordered list element ul... [the attribute value of nodetype is 1]
Text node: a text node is always contained within an element node. [The value of nodetype is 3]
Attribute node: attribute nodes are always placed in the start tag. For example, Title = "a gentle reminder" [the value of nodetype is 2]
The getelementbyid () method returns an object.
Document. getelementbyid (ID) ID must be placed in single or double quotation marks, for example, document. getelementbyid ("purchases ")
The getelementsbytagname () method returns an array of objects.
The getelementsbytagname (TAG) Tag must be the name of the (x) HTML Tag and placed in double quotation marks, for example, document. getelementsbytagname ("Li ")
The getattribute () method queries attributes by calling specific objects.
Object. getattribute (attribute)
Setattribute () method to set attributes
Object. setattribute (attribute, value)