To get around this I used the JavaScript round() Method and the code can be shown below:
<script language="Javascript" type="text/javascript">
<!--
var value1 = 25.00;
var value2 = 23.98;
var result = (value1 - value2) * 100;
var Myresult = Math.round(result) / 100;
document.write("My result is " + Myresult + " and no weird decimals");
//-->
</script>
<!--
var value1 = 25.00;
var value2 = 23.98;
var result = (value1 - value2) * 100;
var Myresult = Math.round(result) / 100;
document.write("My result is " + Myresult + " and no weird decimals");
//-->
</script>
No comments:
Post a Comment