Home >Web Front-end >JS Tutorial >Detailed explanation of JS node knowledge_basic knowledge
Pay attention to the capitalization and make sure there is no mistake.
Attributes:
Attributes stores the node’s attribute list (read-only)
childNodes stores the node’s child node list (read-only)
dataType Returns the data type of this node
Definition The definition of the node given in DTD or XML mode (read-only)
Doctype Specifies the document type node (read-only)
documentElement Returns the root element of the document ( Readable and writable)
firstChild returns the first child node of the current node (read-only)
Implementation returns an XMLDOMImplementation object
lastChild returns the last child node of the current node (read-only)
nextSibling returns the current node The next sibling node (read-only)
nodeName returns the name of the node (read-only)
nodeType returns the type of the node (read-only)
nodeTypedValue stores the node value (readable and writable)
nodeValue returns The text of the node (readable and writable)
ownerDocument returns the root document containing this node (read-only)
parentNode returns the parent node (read-only)
Parsed returns whether this node and its child nodes have been parsed ( Read-only)
Prefix Returns the namespace prefix (read-only)
preserveWhiteSpace Specifies whether to preserve white space (read-write)
previousSibling Returns the previous sibling node of this node (read-only)
Text Returns this The text content of the node and its descendants (readable and writable)
url Returns the URL of the recently loaded XML document (read-only)
Xml Returns the XML representation of the node and its descendants (read-only)
Methods:
appendChild adds a new child node to the current node and places it after the last child node
cloneNode returns a copy of the current node
createAttribute creates a new attribute
createCDATASection creates a include Given a CDATA segment of data
createComment creates a comment node
createDocumentFragment creates a DocumentFragment object
createElement creates an element node
createEntityReference creates an EntityReference object
createNode creates a given type, name and namespace Node
createPorcessingInstruction creates an operation instruction node
createTextNode creates a text node including the given data
getElementsByTagName returns a collection of elements with the specified name
hasChildNodes returns whether the current node has child nodes
insertBefore before the specified node Insert child node
Load Import the XML document at the specified location
loadXML Import the XML document with the specified string
removeChild Remove the specified child node from the child node list
replaceChild Replace the specified child node from the child node list The child node
Save saves the XML file to the specified node
selectNodes performs the specified matching on the node and returns the matching node list
selectSingleNode performs the specified matching on the node and returns the first matching node
transformNode uses the specified style sheet to transform the node and its descendants
transformNodeToObject uses the specified style sheet to transform the node and its descendants into objects
DOM (Document Object Model)
DOM (Document Object Model) concept With the launch of DHTML, this API has made HTML even more powerful, but some friends who are learning DHTML are still a little confused, just because the current manual is not very scientific, and it is divided by letters
, which is inconvenient to read. In fact, the most important thing in DOM is To master the relationship between nodes (between node andnode), if you want to learn the DOM in DHTML, don't read all the properties and methods from beginning to end. You have Zhang Song's "photographic memory" from the Three Kingdoms Do you have the ability to "forget"? No, then let me analyze it:
In fact, what DOM teaches us is a hierarchical structure. You can understand it as a tree structure, just like our directory, a root directory. There are subdirectories under the root directory, and there are subdirectories under the subdirectory
...
Root node: DOM calls every object in the hierarchy a node (NODE) , take HTML hypertext markup language as an example: a root of the entire document is , which can be accessed in the DOM using
document.documentElement, which is the root node (ROOT) of the entire node tree
Child node: A node in the general sense. The largest child node below the root node is the main document area