In a table, I show S.No , Name , Amount, Payable Amount, Balance Amount dynamically.

So I need a calculation to show balance amount by subtracting payable amount with amount for all textboxes in onblur dynamically. Here is my code. But it does for only the first row, and how to do rest of all.

function showbal()
{
document.getElementById('balance').value = document.getElementById('amount').value - document.getElementById('payable_amount').value 
}

The reason is simple , ids are uniques , class names in other hand are not. “So I need a calculation to show balance amount by subtracting payable amount with amount for all textboxes in onblur dynamically.” you wrote , this isn't a question , this is something that you can't express in words. First we must know what is balance amount for you , what is payable amount and what those has to do with the onblur . Provide that simple feeds and probably you will receive help

commented: removed php tag :) +0