JQuery操作html表格 对文本框加一减一的例子 无ID标识之类
<script type="text/javascript">
function calc(obj, val) {
var $input = $($(obj).parent().parent().find("input").eq(0));
var tbVal = parseInt($input.val());
$input.val(tbVal + val);
//var tbVal = parseInt($input.textbox('getValue')); //easyui-textbox方式
//$input.textbox('setValue', tbVal + val);
}
</script>
<table>
<tr>
<td>
<input type="text" value="0" />
@* <input class="easyui-textbox" value="0" />*@
</td>
<td>
<input type="button" onclick="calc(this, 1)" value="+" /><input type="button" onclick=" calc(this, -1)" value="-" />
</td>
</tr>
<tr>
<td>
<input type="text" value="0" />
</td>
<td>
<input type="button" onclick="calc(this, 1)" value="+" /><input type="button" onclick=" calc(this, -1)" value="-" />
</td>
</tr>
<tr>
<td>
<input type="text" value="0" />
</td>
<td>
<input type="button" onclick="calc(this, 1)" value="+" /><input type="button" onclick=" calc(this, -1)" value="-" />
</td>
</tr>
</table>