Hello Everybody
I have a problem with a javascript and i hope someone will be able to help me. I am trying to change the script below from adding the values to subtracting without much luck.
<script type="text/javascript" language="javascript">
function autocalc(oText)
{
if (isNaN(oText.value)) //filter input
{
alert('Numbers only!');
oText.value = '';
}
var field, val, oForm = oText.form, netincome = a = 0;
for (a; a < arguments.length; ++a) //loop through text elements
{
field = arguments[a];
val = parseFloat(field.value); //get value
if (!isNaN(val)) //number?
{
netincome += val; //accumulate
}
}
oForm.netincome.value = netincome; //out
}
</script>
Someone please help
I have a problem with a javascript and i hope someone will be able to help me. I am trying to change the script below from adding the values to subtracting without much luck.
<script type="text/javascript" language="javascript">
function autocalc(oText)
{
if (isNaN(oText.value)) //filter input
{
alert('Numbers only!');
oText.value = '';
}
var field, val, oForm = oText.form, netincome = a = 0;
for (a; a < arguments.length; ++a) //loop through text elements
{
field = arguments[a];
val = parseFloat(field.value); //get value
if (!isNaN(val)) //number?
{
netincome += val; //accumulate
}
}
oForm.netincome.value = netincome; //out
}
</script>
Someone please help