Used to process DOM element attributes of XML documents
Copy codeThe Code is as follows:
ChildNodes: returns an array of all child elements of the current element;
FirstChild: returns the first sub-element of the current element;
LastChild: returns the last child element of the current element;
NextSibling: returns the elements that follow the current element;
NoedValue: Specifies the read/write attribute that represents the element value;
ParentNode: returns the parent node of the element;
Previussibling: returns the element adjacent to the current element;
DOM element method used to traverse XML documents
Copy codeThe Code is as follows:
GetElementById (id) (document): obtains the elements in the document with the specified unique ID attribute value;
GetElementsByTagName (name): returns the array of the child elements specified by the calibration name in the current element;
HasChildNodes (): returns a Boolean value indicating whether the element has child elements;
GetAttribute (name): returns the attribute value of an element, which is specified by name;
W3C DOM attributes and methods used for dynamic content creation
Copy codeThe Code is as follows:
Document. createElement (tagName): The createElement method on the document object can create elements specified by tagName. If the string div is used as the method parameter, a div element is generated;
Document. createTextNode (text): The createTextNode method of the document Object creates a node that contains static text;
<Element>. appendChild (childNode): The appendChild method adds the specified node to the subnode list of the current element (as a new subnode ). For example, you can add an option element as a subnode of the select element;
<Element>. getattrure (name): These methods obtain and set the value of the name attribute in the element respectively;
<Element>. setattrube (name, value): These methods obtain and set the value of the name attribute in the element respectively;
<Element>. insertBefore (newNode, targetNode): This method inserts the node newNode as the child node of the current element before the targetNode element;
<Element>. removeAttribute (name): This method deletes the attribute name from the element;
<Element>. removeChild (childNode): This method deletes the child element childNode from the element;
<Element>. replaceChild (newNode, oldNode): This method replaces the node oldNode with the node newNode;
<Element>. hasChildnodes (): This method returns a Boolean value that specifies whether the element has child elements;