你也可以做这样的事情:
<table id="Table1">
<tbody>
<tr id="tr1">
<td>
The TD: <input type="button" id="button1" value="dothis"/>
</td>
</tr>
<tr id="tr2">
<td>
The TD: <input type="button" id="Button2" value="dothis"/>
</td>
</tr>
</tbody>
</table>
支持JS
$('#Table1 tr').bind('click', function(ev) { return rowClick($(this), ev); }); //Bind the tr click
$('#Table1 input').bind('click', function(ev) { return buttonClick($(this), ev); }) //Bind the button clicks
function rowClick(item, ev) {
alert(item.attr('id'));
return true;
}
function buttonClick(item, ev) {
alert(item.attr('id'));
ev.stopPropagation();
return true;
}
最终,点击上的行是选择操作,而按钮的onclick是删除操作。我一直无法找出做这种作品的好方法。 – JamesEggers 2009-04-14 00:24:28