title: Using inline javascript to change text-box value with with 2 decimal places
body: <p>I have 3 text boxes, the first textbox for total, second for the service fee and the third for the grand total.</p>
  
  <p>The problem is in the service fee. it is working but i have to change it to only display 2 decimal places.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;p&gt;&lt;span&gt;&lt;?php echo $this-&gt;lang-&gt;line('Deposit Amount:');?&gt;&lt;/span&gt; $ 
  &lt;input name="total" class="total" size="10"
      value="&lt;?php if(isset($amount)) echo $amount; else echo set_value('total');?&gt;"
      onKeyUp="document.depositAmount.service_fee.value = 
          document.depositAmount.total.value*(&lt;?php echo $commission?&gt;/100);
          if(Number(document.depositAmount.total.value)){
              document.depositAmount.grand_total.value =
                  parseFloat(document.depositAmount.service_fee.value) +
                  parseFloat(document.depositAmount.total.value)
          } else
              document.depositAmount.grand_total.value=0" 
      type="text"/&gt;
  </code></pre>