Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can any one help me Pleaseeeee!

    Hi everyone

    I wonder if any one can help me, I've been searching the net for a javascript script, which when you type in any figure it will return that figure in written words.

    For example: 200.10 returns two hundred dollars and ten cents,

    and : 1.1 = one dollar and one cent (note single and plural dollar/dollars and cent/cents)

    I've found scripts in PHP & VB but as I know less about these then javascript, can I convert these to javascript (easy) ?

    I don't know where to start, I'm not that great with javascript but could modify and change a working script to fit my bill.


    Many Thanks for any help.

    Steve.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,300
    Thanks
    203
    Thanked 2,561 Times in 2,539 Posts
    Google would have brought up:-

    http://javascript.about.com/library/bltoword.htm

    Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose. And many people are put off if you appear to grovel.

  • #3
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry about the title, and sorry for groveling about being sorry for the title,

    The link you kindly suppled I have been playing with for some time and have tried to add dollars cents etc. but with out success.

    steve

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,300
    Thanks
    203
    Thanked 2,561 Times in 2,539 Posts
    You said "I don't know where to start, I'm not that great with javascript but could modify and change a working script to fit my bill."

    The script is quite a complicated one, but you can modify it by setting a flag to indicate dollar, dollars, cent or cents. Then print the appropriate word.

    Look for
    str += 'point ';
    This needs to be something like:-
    str +='dollar(s)' if there are any cents
    and add str += 'cent(s)' at the end of the string, or if 0 cents then str += 'dollar(s)'

  • #5
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank Philip

    Will have a play around with it between being forced Xmas shopping

    why do people always say it only once a year as if its only one inconvenience

    Steve


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •