Hey Sumit,
You can use jquery which is easy to use and need to write less lines of code. Use any class like 'Amount' on text boxes and use that class in jquery selector.
function CalculateTotals() {
var total=0;
$('.Amount').each(function(){
total+=parseFloat($(this).val());
});
$("#txtVFareTotal").val(total);
}
I hope it will work for you.