当前位置: 代码迷 >> Web前端 >> 关于nextSibling跟nodeValue
  详细解决方案

关于nextSibling跟nodeValue

热度:1   发布时间:2012-10-09 10:21:45.0
关于nextSibling和nodeValue

<input type="radio" name="radio1" value="A" />A

<input type="radio" name="radio1" value="B" />B

<input type="radio" name="radio1" value="C" />C

<input type="radio" name="radio1" value="D" />D

?

document.getElementsByName('radio1').item(0).nextSibling.nodeValue获取A的值

A也是个对象,不过是用nextSibling直接获得的
文档其实可以描绘为一个树形结构,Tree的每个节点表现为一个HTML标记或者HTML标记内的文本项。

nextSibling是获得当前对象的下一个对象
nodeValue是返回一个节点的值