/** * The value is rounded (Reserved 2 decimal places) after formatting into the amount of the form * * @param num Value (number or string) * @return amount format string, such as ' 1,234,567.45 ' * @type String * /function FormatCurrency (num) {num = num.tostring (). Replace (/\$|\,/g, "); if (IsNaN (num)) num = "0"; Sign = (num = = (num) = Math.Abs (num)); num = Math.floor (num*100+0.50000000001); cents = num%100; num = Math.floor (num/100). toString (); if (cents<10) cents = "0" + cents; for (var i = 0; I < Math.floor ((num.length-(1+i))/3); i++) num = num.substring (0,num.length-(4*i+3)) + ', ' + num . substring (num.length-(4*i+3)); Return ((sign)? ': '-') + num + '. ' + cents); /** * The value is rounded (reserved 1 decimal places) after formatting into the amount of the form * * @param num Value (number or string) * @return The amount format string, such as ' 1,234,567.4 ' * @type stri NG */function Formatcurrencytenthou (num) {num = num.tostring (). Replace (/\$|\,/g, "); if (IsNaN (num)) num = "0"; Sign = (num = = (num) = Math.Abs (num)); num = Math.floor (num*10+0.50000000001); CEnts = num%10; num = Math.floor (NUM/10). toString (); for (var i = 0; I < Math.floor ((num.length-(1+i))/3); i++) num = num.substring (0,num.length-(4*i+3)) + ', ' + num . substring (num.length-(4*i+3)); Return ((sign)? ': '-') + num + '. ' + cents); }//Add amount formatted Jquery.extend ({formatfloat:function (src, pos) {var num = parsefloat (src). toFixed (POS); num = num.tostring (). Replace (/\$|\,/g, "); if (IsNaN (num)) num = "0"; Sign = (num = = (num) = Math.Abs (num)); num = Math.floor (num*100+0.50000000001); cents = num%100; num = Math.floor (num/100). toString (); if (cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor (num.length-(1+i)/3); i++) num = num.substring (0,num.length-(4*i+3)) + ', ' +NUM.S Ubstring (num.length-(4*i+3)); Return ((sign)? ': '-') + num + '. ' + cents); } });
The above describes the amount of jquery in the format, including aspects of the content, I hope the PHP tutorial interested in a friend to help.