1. Selection of DOM elements
<! DOCTYPE html>
Summed up mainly these several
Run effect
The above are all direct lookups, the following are indirect lookups
ParentNode //parent node childnodes// All child nodes FirstChild //first child node LastChild //Last child node nextsibling // Next sibling node previoussibling //Previous sibling node these are parentelement //parent node tag elements that contain text children// all child tags firstelementchild //First child tag element lastelementchild //Last child tag element nextelementtsibling //Next sibling tag element previouselementsibling //Previous sibling tag element
Loop the element below the parent label
<! DOCTYPE html>
2. Dom Content operation
Get label content
obj = document.getElementsByTagName (' a ') [0];//goes to the document looking for all a tags, returns a list of alert (obj.innertext);//Gets text information//alert ( obj.innerhtml);//Get inside the whole paragraph of HTML, including text
Value can be used to get the values in the form
<! DOCTYPE html>
Execution results
You can also assign values directly,
You can also manipulate styles directly
Dom manipulation inside JavaScript