![]() |
|
|
+ Search |
![]()
|
Mar 24th, 2000 16:07
Martin Honnen,
Use the round function of http://www.faqts.com/knowledge-base/view.phtml/aid/1157/fid/209/lang/ plus the following function: function format1000 (n, d) { n = round (n, d); for (var i = n.indexOf('.') - 3; i > 0; i -= 3) n = n.substring(0, i) + ',' + n.substring(i); return n; } Examples: alert(format1000(1234567890)) alert(format1000(1234.12345, 4))