[code="java"]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
$(document).ready(function(){ $('.vTotal').each(function(i) { var vTotal = 0; $(this).parent().parent() .find('td:nth-child(' + (i+2) +'),th:nth-child(' + (i+2) +')') .each(function(i) { vTotal -= parseInt($(this).text()); }); $(this).text(vTotal); }); }); //document End
項目 | 數字1 | 數字2 |
AAAA | 60 | 50 |
BBBB | 40 | 20 |
相減: | 0 | 0 |
---|
[/code]
[img]http://elfkid.net/1.gif[/img]
這個是目前相撿出來的數字不對
請問要如何修改才能讓數字相減變成正確的數值呢