可以找到
------------------------------------------------------------------------------
onclick="alert(this.parentElement.parentElement.cells[1].firstChild.value);"
------------------------------------------------------------------------------
onclick="alert(this.parentElement.parentElement.cells[1].firstChild.value);"
onclick="alert(this.parentElement.nextSibling.firstChild.value);"
<tr>
<td>
<input type=button>
</td>
<td>
<input type=textbox>
</td>
</tr>
</table>
BUTTON: tb.rows(0).cells(0).firstChild
TEXT: tb.rows(0).cells(1).firstChild
function getit(utable)
{
var utable = document.getElementById(utable);
var groups = utable.getElementsByTagName("input");
for (var i=0; i<groups.length; i++)
{
var ctype = groups[i].getAttribute("type");
if (ctype == 'text')
{
alert("你的表格中的文本结点已找到,数据为:"+groups[i].value);
/**
*做你的后续处理
**/
}
}
}
</script>
</HEAD><BODY>
<table id="utable"><tr><td><input type=button onclick="getit('utable');" value="Get it"></td><td><input type="text" value="Your text node data!!"></td></tr></table>
<input type="text" value="Your text node data2!!">
<input type="text" value="Your text node data3!!">
</BODY>
</HTML>