<KÖRPER>
<div> aaaa </div>
<div> bbbb </div>
<div id = "c"> cccc </div>
<div> dddd </div>
<input type = "button" value = "获取上一节点" id = "pre">
<Eingabe type = "button" value = "获取下一节点" id = "next">
<Script Language = "JavaScript">
<!--
document.getElementById ("pre"). onclick = function () {
var node = document.getElementById ("c"). Voreingenommener SIBLING;
while (node.nodetype! = 1) {
node = node.previoussibling;
if (! node) return null;
};
Alert (Node.innerHtml);
Rückkehrknoten;
}
document.getElementById ("next"). onclick = function () {
var node = document.getElementById ("c"). Nextsibling;
while (node.nodetype! = 1) {
node=node.nextSibling;
if (! node) return null;
};
Alert (Node.innerHtml);
Rückkehrknoten;
}
//-->
</SCRIPT>
</BODY>
主要是 ff 种会识别回车行换当作一个 #Text 节点 而 ie 不会 !!