【文章內(nèi)容簡(jiǎn)介】
attr object39。s properties and methods are described below:PropertiesPropertyDescriptionattributesReturns a NamedNodeMap that contains all attributes of a nodechildNodesReturns a node list that contains all children of a nodefirstChildReturns the first child node of a nodelastChildReturns the last child node of a nodenameReturns the name of the attributenextSiblingReturns the node immediately following a node. Two nodes are siblings if they have the same parent nodenodeNameReturns the name of the node (depending on the node type)nodeTypeReturns the node type as a numbernodeValueReturns the value of the nodeownerDocumentReturns the Document object of a node (returns the root node of the document)parentNodeReturns the parent node of a nodepreviousSiblingReturns the node immediately preceding a node. Two nodes are siblings if they have the same parent nodevalueReturns the value of the attributeMethodsMethodDescriptionappendChild(tagname)Appends a new child node to a nodecloneNode(boolean)Creates an exact clone node of a node. If the boolean parameter is set to true, the cloned node clones all the child nodes of the original node as wellhasChildNodes()Returns true if a node has child nodes. Otherwise it returns falseinsertBefore(newnode,refnode)Inserts a new node (newnode) before the existing node (refnode)removeChild(nodename)Removes the specified node and returns itreplaceChild(newnode,oldnode)Replaces the oldnode with the newnode, and returns the oldnodeThe CDATASection ment objectThe CDATASection object represents CDATASection nodes in a document. A CDATASection node is used to escape parts of text which normally would be recognized as markup.The CDATASection object39。s properties and methods are described below:PropertiesPropertyDescriptionattributesReturns a NamedNodeMap that contains all attributes of a nodechildNodesReturns a node list that contains all children of a nodedataReturns the data of the nodefirstChildReturns the first child node of a nodelastChildReturns the last child node of a nodelengthReturns the length of the data (in characters)nextSiblingReturns the node immediately following a node. Two nodes are siblings if they have the same parent nodenodeNameReturns the name of the node (depending on the node type)nodeTypeReturns the node type as a numbernodeValueReturns the value of the nodeownerDocumentReturns the Document object of a node (returns the root node of the document)parentNodeReturns the parent node of a nodepreviousSiblingReturns the node immediately preceding a node. Two nodes are siblings if they have the same parent nodeMethodsMethodDescriptionappendChild(tagname)Appends a new child node to a nodeappendData(strdata)Appends the specified string to the existing datacloneNode(boolean)Creates an exact clone node of a node. If the boolean parameter is set to true, the cloned node clones all the child nodes of the original node as welldeleteData(offset,count)Removes the specified range of characters from the datahasChildNodes()Returns true if a node has child nodes. Otherwise it returns falseinsertBefore(newnode,refnode)Inserts a new node (newnode) before the existing node (refnode)insertData(offset,string)Inserts the stringdata at the specified offsetremoveChild(nodename)Removes the specified node and returns itreplaceChild(newnode,oldnode)Replaces the oldnode with the newnode, and returns the oldnodereplaceData(offset,count,stringdata)Replaces the characters from the specified offset with the stringdataThe Document objectThe document object is the root element in the nodetree. All nodes in the node tree are child nodes of the document object.The document object39。s properties, methods, and events are described below:PropertiesPropertyDescriptionattributesReturns a NamedNodeMap that contains all attributes of a nodechildNodesReturns a node list that contains all children of a nodedoctypeReturns the DTD or Schema for the documentdocumentEleme