本附录内容:
(1)创建节点:
reference = document.createElement(element)
reference = document.createTextNode(text)
(2)复制节点:
reference = node.cloneNode(deep)
(3)插入节点
reference = element.appendChild(newChild)
reference = element.insertBefore(newNode,tagetNode)
(4)删除节点
reference = document.removeChild(node)
(5)替换节点
reference = element.replaceChild(newChild,oldChild)
(6)处理节点
element.setAttribute(attributeName,attributeValue)
(7)查找节点
attributeValue = element.getAttribute(attributeName)
element = document.getElementById(Id)
elements = document.getElementsByTagName(tagName)
booleanValue = element.hasChildNodes
(8)节点属性
name = node.nodeName
value = node.nodeValue
(9)遍历节点树
nodeList = node.childNodes
node.childNodes.length
reference = node.firstChild
reference = node.lastChild
reference = node.nextSibling
reference = node.parentNode
reference = node.previousSibling 属性返回一个给定节点的前一个子节点;只读属性