You all have been much help with my javascript needs...but I need you
again.
Mike gave me this...to add up any of the 7 columns that are changed.
function autoReimb(val, itm) {
var e = document.forms[0].elements,
r = 'autoReimb' + itm,
t = 0;
if(isPosInt(val .value)) {
e[r].value = format(val.valu e * 0.375);
for(var i = 1; i <= 7; ++i) {
if(isPosInt(e['miles' + i].value)) {
t += +e['autoReimb' + i].value;
}
}
e['autotot'].value = format(t);
lineTotal(val,i tm); <-- I added
} else {
e[r].value = '';
}
} //End Function
I added the function call to lineTotal(val,i tm) in order to total the
row...which is also changed when the column was changed.
function lineTotal(val, itm){
var e = document.forms[0].elements,
trvtps = new Array('autoReim b','airRail','c ar','taxi','lod ge','meals','mi sc');
if(isPosInt(val .value)){
t = 0;
for (var i = 0; i < trvtps.length; i++){
var trvitem = trvtps[i];
if(isPosInt(e[trvitem + itm].value)){
t += +e[trvitem + itm].value;
}
}
e['total' + itm].value = format(t);
}
}
Problem is this only works on the last row...and I don't understand
why. I turned my last row into a remark line and then the row above it
which was not the last line worked great but the others did not add up
correctly.
again.
Mike gave me this...to add up any of the 7 columns that are changed.
function autoReimb(val, itm) {
var e = document.forms[0].elements,
r = 'autoReimb' + itm,
t = 0;
if(isPosInt(val .value)) {
e[r].value = format(val.valu e * 0.375);
for(var i = 1; i <= 7; ++i) {
if(isPosInt(e['miles' + i].value)) {
t += +e['autoReimb' + i].value;
}
}
e['autotot'].value = format(t);
lineTotal(val,i tm); <-- I added
} else {
e[r].value = '';
}
} //End Function
I added the function call to lineTotal(val,i tm) in order to total the
row...which is also changed when the column was changed.
function lineTotal(val, itm){
var e = document.forms[0].elements,
trvtps = new Array('autoReim b','airRail','c ar','taxi','lod ge','meals','mi sc');
if(isPosInt(val .value)){
t = 0;
for (var i = 0; i < trvtps.length; i++){
var trvitem = trvtps[i];
if(isPosInt(e[trvitem + itm].value)){
t += +e[trvitem + itm].value;
}
}
e['total' + itm].value = format(t);
}
}
Problem is this only works on the last row...and I don't understand
why. I turned my last row into a remark line and then the row above it
which was not the last line worked great but the others did not add up
correctly.
Comment