|
Subject:
|
Javascript Calculator - Help!
|
|
Posted By:
|
dedbob
|
Post Date:
|
11/16/2003 6:24:50 PM
|
If this has been posted before, I apologize. I have a javascript calculator on my pages. What I want to do, is have the price automatically appear in the price field, but it won't calculate because there is a "$" and a "," in the field.
Is there ANY possible way to remove the "$" AND the "," either on page load or before the calculation? Or better yet, can you tell javascript to ignore the "$" and ","?
I know in PERL, you can use a slash... is there something like that in javascript?
Here's one of the pages where the calculator is located: http://www.collectorcarsforsale.com/collectorcars/listings/l0002.html
Any help would be greatly appreciated.
Thanks! Scott
|
|
Reply By:
|
planoie
|
Reply Date:
|
11/16/2003 10:13:04 PM
|
You can easily search for the $ and , and remove them before you try to do calculations. I beleive the syntax would be something along these lines:
nPrice = priceField.value.replace("$","").replace(",","")
Peter ------------------------------------------------------ Work smarter, not harder.
|
|