Node 接 口 的 特 性 和 方 法

来源:互联网 发布:ipython 安装 windows 编辑:程序博客网 时间:2024/04/30 10:24

特性/方法

类型/返回类型

   

nodeName

String

节点的名字;根据节点的类型而定义

nodeValue

String

节点的值;根据节点的类型而定义

nodeType

Number

节点的类型常量值之一

ownerDocument

Document

指向这个节点所属的文档

firstChild

Node

指向在childNodes列表中的第一个节点

lastChild

Node

指向在childNodes列表中的最后一个节点

childNodes

NodeList

所有子节点的列表

parentNode

Node

返回一个给定节点的父节点。

previousSibling

Node

指向前一个兄弟节点;如果这个节点就是第一个兄弟节

点,那么该值为null

nextSibling

Node

指向后一个兄弟节点;如果这个节点就是最后一个兄弟节

点,那么该值为null

hasChildNodes()

Boolean

当childNodes包含一个或多个节点时,返回真

attributes

NamedNodeMap

包含了代表一个元素的特性的Attr对象;仅用于Element节点

appendChild(node)

Node

将node添加到childNodes的末尾

removeChild(node)

Node

从childNodes中删除node

replaceChild
(newnode, oldnode)

Node

将childNodes中的oldnode替换成newnode

insertBefore
(newnode, refnode)

Node

在childNodes中的refnode之前插入newnode

0 0
原创粉丝点击