document.write只能重绘整个页面innerHTML可以重绘页面的一部分
1) Create a new node
Createdocumentfragment ()//Create a DOM fragment
CreateElement ()//create a specific element
createTextNode ()//Create a text node
(2) Add, remove, replace, insert
AppendChild ()
var node = dcument.createelement ("")
var textnode=document.createtextnode ("Water");
Node.appendchild (Textnode);
RemoveChild ()
var List=document.getelementbyid ("MyList");
List.removechild (List.childnodes[0]);
ReplaceChild ()
document.getElementById ("MyList"). ReplaceChild (Newnode,oldnode);
InsertBefore ()//Insert a new child node before the existing child node
var Node=document.getelementbyid ("MyList2"). LastChild;
var List=document.getelementbyid ("MyList1");
List.insertbefore (Node,list.childnodes[0]);
(3) Find
getElementsByTagName ()//by tag name
Getelementsbyname ()//through the value of the element's Name property (ie is more tolerant of fault tolerance, it will get an array that includes the ID equals the name value)
getElementById ()//through element ID, uniqueness
Dom operations-How to add, remove, move, copy, create, and find nodes