document.all 实质就是文档中所有元素的集合。可以看做一个数组。
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>document.all的用法</title>
<script>
onload = function () {
console.log(document.all);
}
</script>
</head>
<body>
<h1>h1</h1>
<p>段落</p>
<input type="text" value="文本框" />
</body>
</html>


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>document.all的用法</title>
<script>
onload = function () {
//console.log(document.all);
console.log(document.all("num", 0).value);
console.log(document.all("num", 1).value);
console.log(document.all("num", 2).value);
console.log(document.all("paragraph").innerHTML);
}
</script>
</head>
<body>
<h1>h1</h1>
<p id="paragraph">段落</p>
<input type="text" value="文本框" />
<input type="text" value="1" name="num" />
<input type="text" value="2" name="num" />
<input type="text" value="3" name="num" />
</body>
</html>
原文:http://www.cnblogs.com/simple-blog/p/javascript.html