SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: replacing . with nothing
-
Jan 21, 2004, 11:23 #1
- Join Date
- Oct 2002
- Posts
- 229
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
replacing . with nothing
I am having trouble replacing a fullstop with "".
I've tried
commission=commission.replace(".","");
message object does not support this property or method
Is anyone able to advise me on this....
ThanksEternity
-
Jan 21, 2004, 13:06 #2
- Join Date
- May 2000
- Posts
- 313
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Maybe this link will help:
http://devedge.netscape.com/library/...g.html#1194258
-
Jan 21, 2004, 19:20 #3
- Join Date
- May 2003
- Posts
- 1,843
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
.replace() is a method of String - so 'commission' is presumably - at least in some specific application of that line of code - not a string. You'll need to post more of your code, including the source of that value.
::: certified wild guess :::
-
Jan 22, 2004, 03:15 #4
- Join Date
- Oct 2002
- Posts
- 229
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I am creating a calculator in a form and want to add a commission value to the total.
To add the commission value to the total I have used the following maths
total * (1.0 + commission)
so a commission of 3% is 1.03
However then someone adds a decimal to their comission ie 3.2, the javascript gets confused and gives NaN as it is trying to multipy the total by 1.03.2.
This is why I want to remove the fullstop from the original commission value...Eternity
-
Jan 22, 2004, 06:59 #5
- Join Date
- May 2000
- Posts
- 313
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Couldn't you divide commission by 100 giving you .032 and then add 1.0 giving 1.032?
-
Jan 22, 2004, 11:57 #6
- Join Date
- Oct 2002
- Posts
- 229
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ah yes - how simple was that!
Thanks everyoneEternity
Bookmarks