Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-10-2007, 03:41 AM   PM User | #1
murali1983
New Coder

 
Join Date: Oct 2006
Posts: 47
Thanks: 0
Thanked 0 Times in 0 Posts
murali1983 has a little shameless behaviour in the past
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.
murali1983 is offline   Reply With Quote
Old 01-10-2007, 05:34 AM   PM User | #2
whizard
Senior Coder

 
whizard's Avatar
 
Join Date: Jan 2005
Location: Philadelphia, PA, USA
Posts: 1,457
Thanks: 10
Thanked 37 Times in 37 Posts
whizard will become famous soon enoughwhizard will become famous soon enough
Try this:

http://javascript.internet.com/forms...cy-format.html

HTH
Dan
__________________
If you want to use short tags (<? or <?=$var) then make sure short_open_tag is set to "1". It really helps.
Step 1: Learn. Step 2: Search. Step 3: Post here.
whizard is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:38 PM.


Advertisement
Log in to turn off these ads.