【正文】
ceChild(newnode,oldnode)Replaces the oldnode with the newnode, and returns the oldnodesetAttribute(attrname,attrvalue)Sets the value of the named attributesetAttributeNode(attrname)Inserts the specified new attribute to the elementThe Node ObjectThe node object represents a node in the nodetree.The node 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 nodenextSiblingReturns 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 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 NodeList objectThe nodeList object represents a node and its child nodes as a nodetree.The nodeList object39。s properties and methods are described below:PropertiesPropertyDescriptionlengthReturns the number of items in the node listMethodsMethodDescriptionitem(index)Returns the item at the specified index in the node listThe Text objectThe text object represents the text of an attribute or element object. The text 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 stringdata