The code does not show where
subtotal
or
grandtotal
are being called.
But the following advice should help you get you going on getting the code to work :)
NaN
stands for not a number.
http://www.w3schools.com/jsref/jsref_parsefloat.asp[
^]
Note: If the first character cannot be converted to a number,
parseFloat
returns NaN.
I am assuming the $ character is the first character being checked as that is the format specified to be used for the input, also an empty string is NaN.
function subtotal(){
var as = $("#as").val();
var txt1 = $('#sff').val();
var txt2 = $('#osf').val();
var d = 0;
var e = 0;
var f = 0;
var g = 0;
var a = parseFloat(as, 10);
var b = parseFloat(txt1, 10);
var c = parseFloat(txt2, 10);
...