Nederlands geld format syntax met javascript, support voor IE9 browser

By.

min read

My profile

Share this:

When https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString fails due to choice of browser, you might need to take a look at:

http://javascript.about.com/library/blnumfmt.htm
[code:1:a60c817d87]// number formatting function
// copyright Stephen Chapman 24th March 2006, 22nd August 2008
// permission to use this function is granted provided
// that this copyright notice is retained intact

function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {var x = Math.round(num * Math.pow(10,dec));if (x >= 0) n1=n2=”;var y = (”+Math.abs(x)).split(”);var z = y.length – dec; if (z<0) z–; for(var i = z; i < 0; i++) y.unshift(’0’); if (z<0> 3) {z-=3; y.splice(z,0,thou);}var r = curr1+n1+y.join(”)+n2+curr2;return r;}[/code:1:a60c817d87]

Dutch call:
[code:1:a60c817d87]formatNumber(myInputValue,2,’.’,’,’,”,”,’-‘,”)[/code:1:a60c817d87]

Will transform 10000 to 10.0000,00
and 6.68 to 6,68

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *