<html>
<meta charset="utf-8" />
<head>
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">
function bianli() {
$("#tset").find("tr").each(function() {
var tdArr = $(this).children();
var history_income_type = tdArr.eq(0).find("input").val(); //收入类别
var history_income_money = tdArr.eq(1).find("input").val(); //收入金额
var history_income_remark = tdArr.eq(2).find("input").val(); // 备注
alert(history_income_type);
alert(history_income_money);
alert(history_income_remark);
});
}
</script>
</head>
<body>
<td align="center"><input type="button" οnclick="bianli();" value="test" /></td>
<div id="tset">
<table>
<tbody id="table">
<tr>
<td align="center"><input type="text"></td>
<td align="center"><input type="text"></td>
<td align="center"><input type="text"></td>
</tr>
<tr>
<td align="center"><input type="text"></td>
<td align="center"><input type="text"></td>
<td align="center"><input type="text"></td>
</tr>
<tr>
<td align="center"><input type="text" class="input-s input-w input-hs"></td>
<td align="center"><input type="text" class="input-s input-w input-hs"></td>
<td align="center"><input type="text" class="input-s input-w input-hs"></td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
遍历table中的tr td
最新推荐文章于 2021-07-17 20:49:42 发布