|
-
Jan 11th, 2005, 02:20 PM
#3
New Member
Re: JavaScript - Currency Function
Thanks for the post Travis! It was a great starting point.
I've tweaked Travis' RegExp a little to allow for commas:
bIsValidCurrency = RegExp(/^\$?[0-9\,]+(\.\d{2})?$/).test(String(txtValue).replace(/^\s+|\s+$/g, ""));
You could also allow for negative currency values with:
bIsValidCurrency = RegExp(/^-?\$?[0-9\,]+(\.\d{2})?$/).test(String(txtValue).replace(/^\s+|\s+$/g, ""));
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|