Dom is the greatest innovation in web history after HTML first appeared on the Internet.
1.
XML preface: <? XML version = "1.0"?>
Followed by the preface, it is generally pi-processing command, in order to process the pageProgram(For example, XML Parser) provides additional information. The only format requirement is that the first question mark must be followed by at least
There is a letter.
The most common pi is to specify a style sheet: <? XML-stylesheet type = "text/CSS" href = "style.css"?>
2.
Node Type
Alert (document. nodetype) // outputs "9"
Get and change the attribute value of a node
OBJ. getattribute (name );
OBJ. setattribute (attrname, newvalue );
Get all objects in document
Document. getelementsbytagname ("*"); // Mozilla
Document. All // IE 6
Common methods for creating nodes: browsers support these common methods;
Createdocumentfragment () // Add a File Fragment (or object set ). (Fragments can contain multiple objects)
Createelement ()
Createtextnode ()
Code:
<Head>
<SCRIPT type = "text/JavaScript">
Function createhello (){
VaR op = Document. createelement ("p ");
VaR optext = Document. createtextnode ("Hello World ");
Op. appendchild (optext );
Document. Body. appendchild (OP );
}
</SCRIPT>
</Head>
<Body onload = "createhello ()">
</Body>
Use the following methods
Appendchild (), removechild (), replaceChild (), insertbefore ()
Searcher nodeiterate and treewalker for deep traversal (see Book P159-P160)