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 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    NUmber formatting in the form $1,234,567.89

    Hi,

    can u plz help me to get the below requirement....

    initially my text box contains the the value $0.00,and user can enter a maximum of 9 digits

    when user enters the input the output should be inthe form as shown below.


    initial | userInput | OutPUt

    $0.00 1 -> $0.01

    $0.00 12 -> $0.12

    $0.00 123 -> $1.23

    $0.00 1234 -> $12.34

    $0.00 12345 -> $123.45

    $0.00 123456 -> $1,234.56

    $0.00 1234567 -> $12,345.67

    $0.00 12345678 -> $123,346.78

    $0.00 123456789 -> $1,234,567.89

    $0.00 .(dot as input) $0.00
    $0.00 .1 $0.10
    $0.00 .11 $0.11


    once dot is entered in the text box maximum of 2 digits can be entered follwing the dot.
    dot should be accepted only when there is space for two digits.

    thnx
    Murali.

  • #2
    Senior Coder whizard's Avatar
    Join Date
    Jan 2005
    Location
    Philadelphia, PA, USA
    Posts
    1,662
    Thanks
    14
    Thanked 76 Times in 76 Posts
    PHP Tip: If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.

    Don't forget to save everyone time and mark your thread as Resolved :)

    "Also note that it is your responsibility to die() if necessary."

    DON'T USE THE MYSQL_ EXTENSION


  •  

    Posting Permissions

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