I have a receipt that I am working on that does the math for me. I need the results to show up as dollar values.
My HTML:
<input type="text" name="copy1" id="copy1" size="4" maxlength="10" onchange="calculate(this.value)">
<input type="text" name="copycosts" id="copycosts" size="4" VALUE=""/>
My JavaScript:
<script type="text/javascript">
function calculate(){
var copy1value = parseFloat(document.getElementById("copy1").value, 10);
document.getElementById("copycosts").value = copy1value * 0.50;
}
</script>
How do I add 2 decimal places after the multiplication is completed? For instance 13 * 0.50 = 6.5 -- I want it to say 6.50.
Thanks in advance.