阮一峰的IT笔记:首页 -> 分类 -> Javascript 查看所有文章:按分类 | 按月份

DOM模型的属性和方法

1. Node的属性

Node properties:childNodes,firstChild, lastChild, nextSibling, previousSibling, parentNode.

2. Nodes的方法

Node methods: appendChild(), removeChild(), replaceChild(), insertBefore().

3. nodeType属性

nodeType属性的几个值: Node.ELEMENT_NODE, Node.TEXT_NODE, Node.DOCUMENT_NODE, Node.COMMENT_NODE, Node.DOCUMENT_FRAGMENT_NODE,
Node.ATTRIBUTE_NODE。

也就是说,在一个普通的HTML文档中,Node有6种类型Element, TEXT, Document, Comment, DocumentFragment, Attr.

4.

在一个DOM树中,只有一个Document物体,大多数Nodes是Element物体和Text物体,或者可能还有Comment和Attr物体。

5. Element物体中与Attribute有关的方法

getAttribute(), setAttribute(), 和 removeAttribute()

6.

针对HTML文件,Document对象定义了一个子界面HTMLDocument。

HTMLDocument有6个属性:id, style, title, lang, dir, 和 className。

« 压缩文件的生成及解压缩 | 首页 | DOM conformance in Internet Explorer »

About

This page contains a single entry from the blog posted on 2007年03月30日 00:01.

The previous post in this blog was 压缩文件的生成及解压缩.

The next post in this blog is DOM conformance in Internet Explorer.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33

Post a comment