The DOM is the abbreviation for Document Object model, which is an API for document-based programming.
Using JavaScript to manipulate DOM objects is usually divided into three categories: 1.DOM CORE 2.html-dom and Css-dom.
This code involves 1 of the knowledge points. How to lock a node 2. Returns the formula used by the child node collection 3. How to traverse a node type
<! DOCTYPE html>
<title>4</title>
<script>
Window.onload=function () {
var Myul=document.getelementbyid ("box");//Lock element
Var lis=myul.childnodes;//returns a collection of child nodes
for (var i = 0; i < lis.length; i++) {
Create a loop, length of the child node collection
if (lis[i].nodetype==1) {
If the node type of each item that iterates through the collection of child nodes is an element node type (that is, nodetype==1)
alert (lis[i].innerhtml);
}
}
}
</script>
<body>
<ul id= "box" >
<li> Dinner </li>
<li> Sleep </li>
<li> dozen Peas </li>
</ul>
</body>
The knowledge points involved in this code are: How to create a label and how to add content to a new tag that you add
JavaScript operates the code for the Dom Action node property:
The knowledge points involved are: 1 gets the formula for the property value and the formula that sets the property value
JavaScript Operations DOM Delete and replace node code
Code to manipulate the node style:
Above reference
JavaScript manipulating DOM objects