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

遍历DOM元素的方法

1. getElementById(id)

获取有指定唯一ID属性值文档中的元素。

2. getElementByTagName(name)

返回当前元素中有指定标记名的子元素的数组。

3. hasChildNodes()

返回一个布尔值,指示元素是否有子元素。

4. getAttribute(name)

返回元素的属性值,属性由name指定。

« DOM元素的属性 | 首页 | 读取XML文档示例:服务器返回美国州名列表 »

About

This page contains a single entry from the blog posted on 2007年05月06日 11:32.

The previous post in this blog was DOM元素的属性.

The next post in this blog is 读取XML文档示例:服务器返回美国州名列表.

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