label_red
Threadersteller
Dabei seit: 25.04.2004
Ort: -
Alter: 45
Geschlecht:
|
Verfasst Fr 22.08.2008 14:01
Titel Flash Darstellung von Zahlen im Textfeld. |
|
|
Hallo,
ich google mir schon die Finger wund, dabei möchte ich nur eine Trennung der 1000er Werte durch einen Punkt.
1000 ist es bisher, es soll aber 1.000 werden.
Gefunden dazu hab ich eine komplexe Lösung in der man das Textfeld ausmisst. Hat das schon jmd. einfacher realisiert?
zahl.slice"."zahl.slice , was ne riesige Schleife zur folge hat, bringt es nich wirklich
Zuletzt bearbeitet von label_red am Fr 22.08.2008 14:12, insgesamt 1-mal bearbeitet
|
|
ALEXX
Dabei seit: 26.08.2004
Ort: Köln
Alter: 37
Geschlecht:
|
Verfasst Di 26.08.2008 16:15
Titel
|
|
|
5 sek google: http://www.flashforum.de/forum/archive/index.php/t-206331.html
Code: | Number.prototype.moneyFormat = function (pCurrency) {
var firstPart = String (this).split (".")[0];
var secondPart = String (this).split (".")[1];
while (secondPart.length < 2) {
secondPart += "0";
}
if (secondPart == undefined) {
secondPart = "00";
}
var tmpArr = firstPart.split ("");
for (var i in tmpArr) {
if ((tmpArr.length - i) % 4 == 3 && i > 0) {
tmpArr.splice (i, 0, ".");
}
}
return tmpArr.join ("") + "," + secondPart + " " + pCurrency;
}
// Aufruf:
var n = 1613.2;
trace (n.moneyFormat ("EUR"));
// --> liefert: 1.613,20 EUR |
|
|