Note that you must not make mistakes in upper and lower case.
property:
Attributes List of attributes for storage nodes (read-only)
childNodes The child node list of storage nodes (read-only)
dataType Returns the data type of this node
Definition Definition of nodes given in DTD or XML schema (read-only)
Doctype Specifies the document type node (read-only)
documentElement Returns the root element of the document (readable and writeable)
firstChild Returns the first child node of the current node (read-only)
Implementation Returns XMLDOMImplementation object
lastChild returns the last child node of the current node (read-only)
nextSibling returns the next sibling node of the current node (read-only)
nodeName Returns the name of the node (read-only)
nodeType Returns the type of the node (read-only)
nodeTypedValue stores node value (readable and writeable)
nodeValue Returns the text of the node (readable and writeable)
ownerDocument Returns the root document containing this node (read-only)
parentNode returns the parent node (read-only)
Parsed Returns whether this node and its children have been parsed (read-only)
Prefix returns namespace prefix (read-only)
preserveWhiteSpace Specifies whether to keep blanks (readable and writeable)
previousSibling returns the previous sibling node of this node (read-only)
Text Returns the text content of this node and its descendants (readable and writeable)
url Returns the URL of the recently loaded XML document (read-only)
Xml returns the XML representation of the node and its descendants (read-only)
method:
appendChild Add a new child node to the current node and place it after the last child node
cloneNode returns the copy of the current node
createAttribute Create new attribute
createCDATASection Creates a CDATA segment that includes the given data
createComment Create a comment node
createDocumentFragment Creates DocumentFragment object
createElement Create an element node
createEntityReference Create an EntityReference object
createNode Creates nodes for a given type, name and namespace
createPorcessingInstruction Create an operation command node
createTextNode Creates a text node that includes the given data
getElementsByTagName Returns the set of elements of the specified name
hasChildNodes Returns whether there are children in the current node
insertBefore Insert child nodes before specified node
Load Import XML documents at the specified location
loadXML Import XML document of the specified string
removeChild Remove specified child node from child node list
replaceChild Replace the specified child node from the child node list
Save Save XML file to the specified node
selectNodes Makes a specified match to the node and returns the matching node list
selectSingleNode makes a specified match to the node and returns the first matching node
transformNode converts nodes and their descendants using the specified stylesheet
transformNodeToObject converts nodes and their descendants into objects using the specified stylesheet
DOM (Document Object Model)
The introduction of the concept of DOM (document object model) has made HTML more powerful, but some friends who learn DHTML are still a little confused, just because the current manual is not very scientific and it is based on letters.
It is inconvenient to check it out. In fact, the most important thing in DOM is to master the relationship between nodes and nodes. If you want to learn DOM in DHTML, don't look at it from beginning to end.
With some attributes and methods, do you have the ability to "not forget everything" when Zhang Song was in the Three Kingdoms? No, let me analyze it:
In fact, what DOM teaches us is a hierarchy, which you can understand as a tree structure, just like our directory, a root directory, there are subdirectories under the root directory, and there are subdirectories under the subdirectories.
Table of contents……
Root node:
DOM calls every object in the hierarchy a node (NODE). Taking HTML hypertext markup language as an example: one root of the entire document is <html>, which can be used in DOM.
Come to access it, it is the root node (ROOT) of the entire node tree
Child nodes:
In a general sense, the largest child node below the root node is the main document area <body>. To access the body tag, you should write it in the script:
All text and HTML tags within the body area are nodes of the document, called text nodes and element nodes (or tag nodes). Everyone knows that HTML is just text after all.
No matter what kind of web page it is, it must be composed of these two nodes, and can only be composed of these two nodes.
Relationship between nodes:
The relationship between nodes is also the most important joint in DOM. How to correctly refer to node objects must be clear about the mutual description of each node in the node tree. In DHTML,
Javascript scripts use a complete set of methods and properties of each node object to describe another node object.
Absolute reference to a node:
Return the root node of the document
Return to the tag node that was hit in the current document
Return to the source node moved out by the mouse
Return to the source node moved in by the mouse
Returns the source node of the activation event
Relative reference to node: (Suppose the current node is node)
Return to the parent node
Returns the set of child nodes (including text nodes and tag nodes)
Return the child tag node collection
Returns the collection of subtext nodes
Return to the first child node
Return to the last child node
Return to the next node of the same
Return to the previous node of the same origin
Various operations of nodes: (Suppose the current node is node)
Added a tag node handle:
(sNode) //The parameter is the node label name to be added, for example: newnode=("div");
, add nodes:
Append child nodes:
(oNode) //oNode adds new node handle for life, example: (newnode)
Application tag node
(oNode,sWhere)//oNode adds the node handle for the new life. sWhere has two values: outside/inside, is added outside or inside the current node?
Insert node
()
()
()
, modify nodes:
Delete nodes
()
()
()
Replace nodes
()
()
()
, replication node:
Return the replication replication node reference
(bAll)//bAll is a boolean value, true / false Whether to clone all children of the node
, node information
Whether it contains a node
()
Is there a child node
()
*******************************************************
The following is the javascript operation xml
<script language="JavaScript">
<!--
var doc = new ActiveXObject(""); //ie5.5+,CreateObject("")
//Load the document
//("");
//Create file header
var p = ("xml","version='1.0' encoding='gb2312'");
//Add file header
(p);
// Used to obtain root contact when loading directly
//var root = ;
//Two ways to create root contact
// var root = ("students");
var root = (1,"students","");
//Create child contact
var n = (1,"ttyp","");
//Specify subcontact text
// = " this is a test";
//Create a Sun contact
var o = ("sex");
= "Male"; //Specify its text
//Create properties
var r = ("id");
="test";
//Add attributes
(r);
//Create the second property
var r1 = ("class");
="tt";
//Add attributes
(r1);
//Delete the second attribute
("class");
//Add Sun contact
(o);
//Add text contacts
(("this is a text node."));
//Add comment
(("this is a comment\n"));
//Add child contacts
(n);
//Copy the contact
var m = (true);
(m);
//Delete the contact
((0));
//Create data segment
var c = ("this is a cdata");
= "hi,cdata";
//Add data segment
(c);
//Add root contact
(root);
//Find contacts
var a = ("ttyp");
//var a = ("//ttyp");
//Show the properties of the modified contact point
for(var i= 0;i<;i++)
{
alert(a[i].xml);
for(var j=0;j<a[i].;j++)
{
alert(a[i].attributes[j].name);
}
}
//Modify the node and locate the node using XPATH
var b = ("//ttyp/sex");
= "female";
//alert();
//XML save (need to use FSO on the server side)
//();
//View root contact XML
if(n)
{
alert();
}
//-->
</script>
property:
Attributes List of attributes for storage nodes (read-only)
childNodes The child node list of storage nodes (read-only)
dataType Returns the data type of this node
Definition Definition of nodes given in DTD or XML schema (read-only)
Doctype Specifies the document type node (read-only)
documentElement Returns the root element of the document (readable and writeable)
firstChild Returns the first child node of the current node (read-only)
Implementation Returns XMLDOMImplementation object
lastChild returns the last child node of the current node (read-only)
nextSibling returns the next sibling node of the current node (read-only)
nodeName Returns the name of the node (read-only)
nodeType Returns the type of the node (read-only)
nodeTypedValue stores node value (readable and writeable)
nodeValue Returns the text of the node (readable and writeable)
ownerDocument Returns the root document containing this node (read-only)
parentNode returns the parent node (read-only)
Parsed Returns whether this node and its children have been parsed (read-only)
Prefix returns namespace prefix (read-only)
preserveWhiteSpace Specifies whether to keep blanks (readable and writeable)
previousSibling returns the previous sibling node of this node (read-only)
Text Returns the text content of this node and its descendants (readable and writeable)
url Returns the URL of the recently loaded XML document (read-only)
Xml returns the XML representation of the node and its descendants (read-only)
method:
appendChild Add a new child node to the current node and place it after the last child node
cloneNode returns the copy of the current node
createAttribute Create new attribute
createCDATASection Creates a CDATA segment that includes the given data
createComment Create a comment node
createDocumentFragment Creates DocumentFragment object
createElement Create an element node
createEntityReference Create an EntityReference object
createNode Creates nodes for a given type, name and namespace
createPorcessingInstruction Create an operation command node
createTextNode Creates a text node that includes the given data
getElementsByTagName Returns the set of elements of the specified name
hasChildNodes Returns whether there are children in the current node
insertBefore Insert child nodes before specified node
Load Import XML documents at the specified location
loadXML Import XML document of the specified string
removeChild Remove specified child node from child node list
replaceChild Replace the specified child node from the child node list
Save Save XML file to the specified node
selectNodes Makes a specified match to the node and returns the matching node list
selectSingleNode makes a specified match to the node and returns the first matching node
transformNode converts nodes and their descendants using the specified stylesheet
transformNodeToObject converts nodes and their descendants into objects using the specified stylesheet
DOM (Document Object Model)
The introduction of the concept of DOM (document object model) has made HTML more powerful, but some friends who learn DHTML are still a little confused, just because the current manual is not very scientific and it is based on letters.
It is inconvenient to check it out. In fact, the most important thing in DOM is to master the relationship between nodes and nodes. If you want to learn DOM in DHTML, don't look at it from beginning to end.
With some attributes and methods, do you have the ability to "not forget everything" when Zhang Song was in the Three Kingdoms? No, let me analyze it:
In fact, what DOM teaches us is a hierarchy, which you can understand as a tree structure, just like our directory, a root directory, there are subdirectories under the root directory, and there are subdirectories under the subdirectories.
Table of contents……
Root node:
DOM calls every object in the hierarchy a node (NODE). Taking HTML hypertext markup language as an example: one root of the entire document is <html>, which can be used in DOM.
Come to access it, it is the root node (ROOT) of the entire node tree
Child nodes:
In a general sense, the largest child node below the root node is the main document area <body>. To access the body tag, you should write it in the script:
All text and HTML tags within the body area are nodes of the document, called text nodes and element nodes (or tag nodes). Everyone knows that HTML is just text after all.
No matter what kind of web page it is, it must be composed of these two nodes, and can only be composed of these two nodes.
Relationship between nodes:
The relationship between nodes is also the most important joint in DOM. How to correctly refer to node objects must be clear about the mutual description of each node in the node tree. In DHTML,
Javascript scripts use a complete set of methods and properties of each node object to describe another node object.
Absolute reference to a node:
Return the root node of the document
Return to the tag node that was hit in the current document
Return to the source node moved out by the mouse
Return to the source node moved in by the mouse
Returns the source node of the activation event
Relative reference to node: (Suppose the current node is node)
Return to the parent node
Returns the set of child nodes (including text nodes and tag nodes)
Return the child tag node collection
Returns the collection of subtext nodes
Return to the first child node
Return to the last child node
Return to the next node of the same
Return to the previous node of the same origin
Various operations of nodes: (Suppose the current node is node)
Added a tag node handle:
(sNode) //The parameter is the node label name to be added, for example: newnode=("div");
, add nodes:
Append child nodes:
(oNode) //oNode adds new node handle for life, example: (newnode)
Application tag node
(oNode,sWhere)//oNode adds the node handle for the new life. sWhere has two values: outside/inside, is added outside or inside the current node?
Insert node
()
()
()
, modify nodes:
Delete nodes
()
()
()
Replace nodes
()
()
()
, replication node:
Return the replication replication node reference
(bAll)//bAll is a boolean value, true / false Whether to clone all children of the node
, node information
Whether it contains a node
()
Is there a child node
()
*******************************************************
The following is the javascript operation xml
<script language="JavaScript">
<!--
var doc = new ActiveXObject(""); //ie5.5+,CreateObject("")
//Load the document
//("");
//Create file header
var p = ("xml","version='1.0' encoding='gb2312'");
//Add file header
(p);
// Used to obtain root contact when loading directly
//var root = ;
//Two ways to create root contact
// var root = ("students");
var root = (1,"students","");
//Create child contact
var n = (1,"ttyp","");
//Specify subcontact text
// = " this is a test";
//Create a Sun contact
var o = ("sex");
= "Male"; //Specify its text
//Create properties
var r = ("id");
="test";
//Add attributes
(r);
//Create the second property
var r1 = ("class");
="tt";
//Add attributes
(r1);
//Delete the second attribute
("class");
//Add Sun contact
(o);
//Add text contacts
(("this is a text node."));
//Add comment
(("this is a comment\n"));
//Add child contacts
(n);
//Copy the contact
var m = (true);
(m);
//Delete the contact
((0));
//Create data segment
var c = ("this is a cdata");
= "hi,cdata";
//Add data segment
(c);
//Add root contact
(root);
//Find contacts
var a = ("ttyp");
//var a = ("//ttyp");
//Show the properties of the modified contact point
for(var i= 0;i<;i++)
{
alert(a[i].xml);
for(var j=0;j<a[i].;j++)
{
alert(a[i].attributes[j].name);
}
}
//Modify the node and locate the node using XPATH
var b = ("//ttyp/sex");
= "female";
//alert();
//XML save (need to use FSO on the server side)
//();
//View root contact XML
if(n)
{
alert();
}
//-->
</script>