dollarformat

Discussion in 'Javascript' started by HandersonVA, May 10, 2005.

  1. HandersonVA

    HandersonVA Guest

    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?
     
    HandersonVA, May 10, 2005
    #1
    1. Advertising

  2. HandersonVA

    RobG Guest

    Check out the group FAQ:

    <URL:http://jibbering.com/faq/#FAQ4_6>
     
    RobG, May 10, 2005
    #2
    1. Advertising

  3. HandersonVA

    RobG Guest

    Sorry, the URL was incomplete. Seems the new version of Firefox is a
    bit different...

    <URL:http://www.jibbering.com/faq/#FAQ4_6>
     
    RobG, May 10, 2005
    #3
  4. HandersonVA

    HandersonVA Guest

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

    "RobG" <> wrote in message
    news:...
    > Sorry, the URL was incomplete. Seems the new version of Firefox is a
    > bit different...
    >
    > <URL:http://www.jibbering.com/faq/#FAQ4_6>
    >
     
    HandersonVA, May 10, 2005
    #4
  5. HandersonVA

    Evertjan. Guest

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

    > "RobG" <> wrote in message
    >> Sorry, the URL was incomplete. Seems the new version of Firefox is a
    >> bit different...
    >>
    >> <URL:http://www.jibbering.com/faq/#FAQ4_6>


    [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);
    };

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., May 10, 2005
    #5
  6. JRS: In article <Xns96526902E7807eejj99@194.109.133.29>, dated Tue, 10
    May 2005 08:19:18, seen in news:comp.lang.javascript, Evertjan.
    <> posted :
    >
    >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; .

    --
    © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
    <URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
    <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
    <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
     
    Dr John Stockton, May 10, 2005
    #6
  7. HandersonVA

    Evertjan. Guest

    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

    ;-/}

    --
    Evertjan.
    The Netherlands.
    (Replace all crosses with dots in my emailaddress)
     
    Evertjan., May 11, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page