DOM element properties for processing XML documents
Copy Code code as follows:
ChildNodes: Returns an array of all child elements of the current element;
FirstChild: Returns the first subordinate child element of the current element;
LastChild: Returns the last child element of the current element;
NextSibling: Returns the element immediately following the current element;
Noedvalue: Specifies the read/write property that represents the value of the element;
ParentNode: Returns the parent node of the element;
PreviousSibling: Returns the element immediately preceding the current element;
Dom element method for traversing an XML document
Copy Code code as follows:
getElementById (ID) (document): Gets the element in the document with the specified unique id attribute value;
getElementsByTagName (name): Returns an array of child elements of the specified tag name in the current element;
HasChildNodes (): Returns a Boolean value indicating whether the element has child elements;
GetAttribute (name): Returns the attribute value of the element, which is specified by name;
The consortium DOM properties and methods used to dynamically create content
Copy Code code as follows:
Document.createelement (tagName) : The CreateElement method on a Document object can create an element that is specified by tagname, and if a string div is used as a 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 list of child nodes of the current element (as a new child node). For example, you can add an option element as a child of a SELECT element;
<element>.getattriture (name): These methods get and set the value of the Name property in the element;
<element >.setattritube (Name,value): Each of these methods gets and sets the value of the Name property in the element;
<element>.insertbefore (Newnode,targetnode) : This method inserts the node newnode as a child of the current element in front of the targetnode element;
<element>.removeattribute (name): This method deletes the property 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;