Menu
In this code how does the total will be come two decimal places
[code=html]
<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, total = 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?
{
total += val; //accumulate
}
}
oForm.total.value = total; //out
}
</script>
Thank you