Formatting numbers with javascript
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1726630/javascript-formatting-number-with-exactly-two-decimals">JavaScript: formatting number with exactly two decimals</a>  </p>
</blockquote>



<p>Can some one please help me with my java script?<br>
My java script consistently counts up, the problem is the cents character length is way too long (need 2 characters max). Another problem is, I don't know what code additionally I need to put commas in the correct position for determining the proper amount. Example: 12345.67 vs 12,345.67. If some one can just take a look at the code, modify it and re-post the full code since I have no idea what to do, I would deeply appreciate it.</p>

<p>This is the javascript code: <a href="http://jsfiddle.net/pqsH6/" rel="nofollow">http://jsfiddle.net/pqsH6/</a></p>

<hr>

<pre><code>&lt;p style="float:left;"&gt;Money Saved: &lt;/p&gt;&lt;b&gt;&lt;p id="ds"  style="float:left;"&gt;$&lt;/p&gt;&lt;/b&gt;
&lt;div id="counter" style="float:left;"&gt;&lt;/div&gt;

&lt;script type="text/javascript"&gt;
    var START_DATE = new Date("january 1, 2012 12:00:00"); // put in the starting date here   
    var INTERVAL = 1000; // savings per second
    var INCREMENT = 0.005; // money saved per second
    var START_VALUE = -50000; // configures proper savings calculation
    var count = 0;
    window.onload = function()
    {
        var msInterval = INTERVAL * 1;
        var now = new Date();
        count = parseInt((now - START_DATE)/msInterval) * INCREMENT + START_VALUE;
        document.getElementById('counter').innerHTML = count;
        setInterval("count += INCREMENT; document.getElementById('counter').innerHTML = count;", msInterval);
    }
&lt;/script&gt;​
</code></pre>
