<input type="button" value="父节点"onclick="change(curTarget.parentNode);" /><input type="button" value="第一个"onclick="change(curTarget.parentNode.firstChild.nextSibling);" /><input type="button" value="上一个"onclick="change(curTarget.previousSibling.previousSibling);" /><input type="button" value="下一个"onclick="change(curTarget.nextSibling.nextSibling);" /><input type="button" value="最后一个"onclick="change(curTarget.parentNode.lastChild.previousSibling);" />
获取表单元素
<form id="d" action="" method="get"><input name="user" type="text" /> <br /><input name="pass" type="text" /> <br /><select name="color"><option value="red">红色</option><option value="blue">蓝色</option></select> <br /><input type="button" value="第一个" onclick="alert(document.getElementById('d').elements[0].value);" /><input type="button" value="第二个" onclick="alert(document.getElementById('d').elements['pass'].value);" /><input type="button" value="第三个" onclick="alert(document.getElementById('d').color.value);" /></form>