<! DOCTYPE HTML > < HTML lang = "EN" > < head > < Meta charset = "UTF-. 8" > < title > the Document </ title > </ head > < body > < div ID = "Box" > < div > this is a region. 1 </ div > < div > this is a region 2 </ div > <div id="c3">This is a region. 3 </ div > < div > This is a region. 4 </ div > < div > This is a region. 5 </ div > </ div > < Script > var C3 = document.getElementById ( ' C3 ' ); // the nextSibling next sibling node // next sibling element nextElementSibling // // sibling node previousSibling // sibling elements on previousElementSibling // the console.log (c3.nextSibling); // console.log(c3.previousSibling); // // console.log(c3.nextElementSibling); // console.log(c3.previousElementSibling); console.log(getNextElementSibling(c3)); // 获取下一个兄弟元素 function getNextElementSibling(element) { var el = element; while (el = el.nextSibling) { if (el.nodeType === 1) { return el; } } return null; } </script> </body> </html>