<>DOM operation

<> One , visit / Get node

document.getElementById(id);// Return to have specified id The first object of

document.getElementsByName(name);// Returns a collection of nodes with the specified name

document.getElementsByTagName(tagname); // Returns a collection of objects with the specified label name

document.getElementsByClassName(classname); // Return with specified class Object collection for name



<> Two , Create node / attribute

* document.createElement() // Create a node
* document.createTextNode() // Create text node
* document.createAttribute() // Create an attribute on a node
<> Three , Add node

* document.inseretBefore(nextNode,referenceNode) // Insert a node before a node
* parentNode.appendChild(newNode) // Add children to a node
<> Four , Replication node

* cloneNode(true/false) // Copy a node
<> Five , Replace node

* replaceChild() // Replace a child node in a given element with another node
<> Six , Delete node

* removeChild(node) // Delete a child node
<> Node attribute operation

* getAttribute(name) // Get the value of a node attribute by attribute name
* setAttribute(name,value) // Modify the value of a node property
* removeAttribute(name) // Delete a property
<> Access relationship acquisition

<> Find child nodes

.firstChild // Get the first child node
.firstElementChild // Get the first element node
.lastChild // Get the last child node
.lastElementChild // Get the last element node
.childNodes // Get all children of a node

<> Get adjacent nodes

.previousSibling Get the adjacent previous node of a known node
.nextSibling Get the next node of a known node

<> Get parent node

.parentNode // Get the parent of a known node

<> Replace node

.replace( newNode,oldNode) Replace the old node with the new one from the parent node

<> Modify text node

* appendData(data): Add node after text node
* insertData(start,data): stay start Insert character at ,start The start value of is 0
* replaceData(start,length,data): stay start Local use data replace length Characters
* deleteData(start,length): from start Delete at length character

©2019-2020 Toolsou All rights reserved,
It's unexpected Python Cherry tree (turtle The gorgeous style of Library )Unity3D of UGUI Basics -- Three modes of canvas os Simple use of module computer network --- Basic concepts of computer network ( agreement , system )html Writing about cherry trees , Writing about cherry trees Some East 14 Pay change 16 salary , Sincerity or routine ?Unity-Demo Examples ✨ realization UI- Backpack equipment drag function 06【 Interpretation according to the frame 】 Data range filtering -- awesome java Four functional interfaces ( a key , simple )