點擊時有一個按鈕運行一個函數,我希望前一個TD中的值從no改爲yes。如何通過Javascript更改之前TD中的值
HTML:
<tr class="odd">
<td class="">13.00</td>
<td class="">DDR</td>
<td class="">No</td>
<td class="">
<div class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="javascript:paid(4);return false" href="#" "="" role="button" aria-disabled="false">
<span class="ui-button-text">Paid</span>
</div>
</td>
</tr>
因此,當用戶點擊 「付費」 這個叫..使用Javascript:
function paid(iD) {
$.ajax({
contentType: "application/json; charset=utf-8",
type: "POST",
url: "Paid",
dataType: "json",
data: "{ id:" + iD +"}",
success: function (id) {
//Here change value of previous TD to yes;
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
}
});
};
有沒有一種方法,我可以訪問以前的TD的html和改變它的價值?
O也使按鈕消失?
是它總是將是最後的TD? – aztechy 2012-07-27 13:36:45
不會有幾行按鈕在 – Beginner 2012-07-27 13:37:16