怎样对 TR 中的 TD 中的 INPUT 取值、赋值?怎样对 TR 中的 TD 中的 INPUT 取值、赋值?怎么对下表中的 input
怎样对 TR 中的 TD 中的 INPUT 取值、赋值?
怎样对 TR 中的 TD 中的 INPUT 取值、赋值?
怎么对下表中的 input 取值、赋值?
<table>
<tr id="guest_1">
<td><input type="text" name="name" id="name" value="1111"></td>
<td><input type="text" name="weight" id="weight"></td>
</tr>
<tr id="guest_2">
<td><input type="text" name="name" id="name" value="2222"></td>
<td><input type="text" name="weight" id="weight"></td>
</tr>
<tr id="guest_3">
<td><input type="text" name="name" id="name" value="3333"></td>
<td><input type="text" name="weight" id="weight"></td>
</tr>
</table>
[解决办法]
- JScript code
var tr = document.getElementById("guest_1");var name = tr.childNodes[0].firstChild.value;var weight = tr.childNodes[1].firstChild.value; 