dollarformat

H

HandersonVA

document.test.form.itemprice.value = itemprice;
alert(itemprice);

If the value is 800.16, it keeps showing as 800.1600.
what will be the function to make this value as a money type?
 
H

HandersonVA

complex than what I thought. any simple function name to format it?
such as dollarformat(variables)
 
E

Evertjan.

HandersonVA wrote on 10 mei 2005 in comp.lang.javascript:

[please do not toppost on usenet]
complex than what I thought. any simple function name to format it?
such as dollarformat(variables)

As we don't all live in a dollar country,
I wouldn't pretend to know what you mean by "dollarformat".

v = 23.5;
document.write(euroformat(v)+'<br>');

v = -123;
document.write(euroformat(v)+'<br>');

function euroformat(x){
return "&euro;&nbsp;" + x.toFixed(2);
};
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Tue, 10
May 2005 08:19:18, seen in Evertjan.
function euroformat(x){
return "&euro;&nbsp;" + x.toFixed(2);
};

For browsers that implement &euro; and toFixed. And the FAQ says that
some toFixed is buggy.

€ gives a Euro sign on at least some systems that do not have
&euro; .

I wonder whether UniCode has a place reserved for the specifically-US
dollar? All sorts of people use \u0024; .
 
E

Evertjan.

Dr John Stockton wrote on 10 mei 2005 in comp.lang.javascript:
I wonder whether UniCode has a place reserved for the specifically-US
dollar?

And what about the specifically-Canadian one?

And the British dollar? ;-\}
All sorts of people use \u0024; .

Not all, my sort does not, we use the &euro;
even though it is not an Uni[que]code

;-/}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top