use the nextSibling and previousSibling properties: <div id="foo1"></div> <div id="foo2"></div> <div id="foo3"></div> document.getElementById('foo2').
確定! 回上一頁