title: Javascript - Calculating total price function and need to throw zero at the end if only 3 numbers
body: <p>The function I’m using calculates the total by dividing by 100 which is only a problem when the price equals something like “27.5” so I want to add a zero at the end if that’s the case. Would I use an if statement? If so, how might I go about writing it?</p>
  
  <pre><code>var frm = document.forms.myForm;
  frm.onchange = function(e) {
      var tot = 0;
      for( var i = 0, l = frm.elements.length; i &lt; l; i++ ) {
          if( frm.elements[i].checked ) {
              tot += parseFloat( frm.elements[i].getAttribute('data-price') );
          }  
      }
      document.getElementById('total').value = "$" + ( tot / 100 );
  }
  </code></pre>
  
  <p><a href="http://jsfiddle.net/CZpnD/" rel="nofollow">calculate total price function on jsfiddle</a></p>