using num.toFixed();
<p>In the function below, where would I include num.toFixed(2); to make the valuer of 'total' display to 2 decimal places (price)?</p>

<pre><code>function calculate_total(id) {
   var theForm = document.getElementById( id )
   total = 0;
   if (theForm.toyCar.checked) {
      total += parseFloat(theForm.toyCar.value);
   } 
   theForm.total.value = total;
   theForm.GrandTotal.value = total + (total*0.18);
}
</code></pre>

<p>This is the output:</p>

<pre><code>&lt;input type="button" name="CheckValue" value = "Calculate cost" onclick="calculate_total(this.form.id)" /&gt;
&amp;nbsp;
Total: &lt;input type="text" name="total" id="total" size="10" readonly="readonly" /&gt;
</code></pre>
