View Full Version : Money format in a textbox
Hi there, does any one know how to make a textbox in money format? I mean that displays $1,000.00 insted of 1000
I have an idea of how to doit in JS but I want to save me the "talacha" of scripting it, so if there are a way in which CSS can help me, and some one out there want to tell me please do it.
Thnx
jalarie
04-24-2003, 03:03 PM
a=prompt('?',0);
if (a.indexOf('.') == -1) { a=a+'.00'; }
i=a.indexOf('.');
while ((i+3) > a.length) {
a=a+'0';
}
for (i=a.length-7; i>=0; i=i-3) {
a=a.substring(0,i+1)+','+a.substring(i+1);
}
alert(a);
Thnx Now all I have to do is apend the "$" THNX
jalarie
04-24-2003, 06:06 PM
Oops!
a=prompt('?',0);
if (a.indexOf('.') == -1) { a=a+'.00'; }
i=a.indexOf('.');
while ((i+3) > a.length) {
a=a+'0';
}
for (i=a.length-7; i>=0; i=i-3) {
a=a.substring(0,i+1)+','+a.substring(i+1);
}
a='$'+a;
alert(a);
By the way, you should not be using $ on a web site. Which dollars are those? Hong Kong? US? Canada? Australia? or someplace else....
See ISO 4217 for a list of three letter currency codes, and http:/www.xe.com/currency/ for examples of usage.
These codes are derived from the ISO 3166 two letter country codes, and the first letter of the name of the currency specified.
See also, ISO 639 for a list of language codes, and ISO 8601 for date and time formats.
Mhtml
04-27-2003, 02:37 PM
Well he should at least prefix the the digits, eg $100.00AUD or £33.3GBP ...
AUD 38.00
USD 123.45
A lot of currencies don't have a symbol, or have a symbol which may not be available on the web surfers machine.
I googled for this:
Standards to be obeyed by the masses: Representing temporal and monetary data on the web:
http://dialspace.dial.pipex.com/town/square/xta78/ISO8601/Knolmayer.pdf
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.