Hi all,
I have a tabular form with a javascript calculation on a column.
Column 9 = column 5 * column 7
See below the javascript (onchange):
<script language="JavaScript" type="text/javascript">
<!--
function calcit(pThis)
{
var vRow = pThis.id.substr(pThis.id.indexOf('_')+1);
document.getElementById('f09_'+vRow).value = document.getElementById('f05_'+vRow).value* document.getElementById('f07_'+vRow).value;
}
//-->
</script>
The columns are of number format 5,234.10
Users now have the abbilty to enter number like 5,234.10455 etc.
The calculation is then done on based on what the user has entered.
But I want the calculation to be done based on 2 decimals (just like the number format specified).
I read that this can be done with toFixed.
Where in my code should i put the toFixed?
I tried putting it like this document.getElementById('f07_'+vRow).value.toFixed(2), but then my javascript calculation no longer calculates.
I could really appreciate some help on this.
Thanks,
Diana
Edited by: dianap on Aug 10, 2012 8:06 AM