Prototype - descendants() 方法
此方法收集元素的所有后代并将它们作为扩展元素数组返回。
请注意,Prototype 的所有 DOM 遍历方法都会忽略文本节点并仅返回元素节点。
语法
element.descendants() ;
返回值
HTML 元素数组。
示例
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function showElements() {
var arr = $('father').descendants();
arr.each(function(node) {
alert(node.nodeName + ': ' + node.innerHTML);
});
}
</script>
</head>
<body>
<p>单击后代按钮查看结果。</p>
<div id = "father">
<p id = "kid">This is first paragraph</p>
</div>
<br />
<input type = "button" value = "descendants" onclick = "showElements();"/>
</body>
</html>

prototype_element_object.html