- Prototype 教程
- Prototype - 主页
- Prototype - 简述
- Prototype - 实用特性
- Prototype - 实用方法
- Prototype - 元素对象
- Prototype - 处理数字
- Prototype - 处理字符串
- Prototype - 处理数组
- Prototype - 处理哈希
- Prototype - 基本对象
- Prototype - 创建模板
- Prototype - 枚举
- Prototype - 事件处理
- Prototype - 表单管理
- Prototype - JSON 支持
- Prototype - AJAX 支持
- Prototype - 表达范围
- Prototype - 定期执行
- Prototype 实用资源
- Prototype - 快速指南
- Prototype - 实用资源
- Prototype - 讨论
Prototype - nextSiblings() 方法
此方法收集元素的所有后代兄弟元素,并将它们作为一个扩展元素数组返回。
注意 - 如果两个元素有相同的父元素,那么它们就是兄弟元素。
语法
element.nextSiblings();
返回值
一个 HTML 元素数组。
示例
<html>
<head>
<title>Prototype examples</title>
<script type = "text/javascript" src = "/javascript/prototype.js"></script>
<script>
function showResult() {
var str = $('mutsu').nextSiblings();
alert( "$('mutsu').nextSiblings() " + str[0].innerHTML );
alert( "$('mutsu').nextSiblings() " + str[1].innerHTML );
var str = $('ida-red').nextSiblings();
alert( "$('ida-red').nextSiblings() " + str[0] );
}
</script>
</head>
<body>
<p>Click the button to see the result.</p>
<ul>
<li id = "golden-delicious">Golden Delicious</li>
<li id = "mutsu">Mutsu</li>
<li id = "mcintosh">McIntosh</li>
<li id = "ida-red">Ida Red</li>
</ul>
<br />
<input type = "button" value = "Click" onclick = "showResult();"/>
</body>
</html>
输出
prototype_element_object.htm
广告