nscnick Posted March 15, 2007 Share Posted March 15, 2007 HiI am trying to format numbers, to display currencies with 2 decimal places. However, I can set the initial value fine but after any calculation it reverts to integer or uncontrolled decimal. These are for display in a table text box or similar.Any help is gratefully received. Link to comment Share on other sites More sharing options...
pulpfiction Posted March 15, 2007 Share Posted March 15, 2007 Try using "toFixed" to format decimal numbers...http://www.mredkj.com/javascript/nfbasic2.html Link to comment Share on other sites More sharing options...
nscnick Posted March 15, 2007 Author Share Posted March 15, 2007 Many many thanks.I couldn't find a similar function/method in the w3schools!Wonderful what peer support can do, thanks again. Link to comment Share on other sites More sharing options...
pulpfiction Posted March 15, 2007 Share Posted March 15, 2007 Glad could help you.... Yeah its not in w3schools tuts, it has mostly kinda basic details.... Link to comment Share on other sites More sharing options...
nscnick Posted March 16, 2007 Author Share Posted March 16, 2007 And after a lot of experimentation I discovered that it converts the number to a string! So I needed an interim value for display purposes to go into the html text box, so that the running total stayed a number!Got there in the end. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now