nscnick Posted March 15, 2007 Share Posted March 15, 2007 HiI am using the result of a js calculation in an html table, and would like to be able to force decimal places to show currencies. Is there a way of doing this? I can't find any function references or formatting information for html, or would I need to to use something else?Many thanks for any help received. Link to comment Share on other sites More sharing options...
PrateekSaxena Posted March 15, 2007 Share Posted March 15, 2007 Try parseInt() Link to comment Share on other sites More sharing options...
jesh Posted March 15, 2007 Share Posted March 15, 2007 Try parseInt() Heh, you mean parseFloat(). The link goes to the right place though. Link to comment Share on other sites More sharing options...
PrateekSaxena Posted March 15, 2007 Share Posted March 15, 2007 Sorry for that, I am doing to many typos these days Link to comment Share on other sites More sharing options...
jesh Posted March 15, 2007 Share Posted March 15, 2007 Sorry for that, I am doing to many typos these days The office is cold today, I'm bound to fat finger a few keystrokes myself! Link to comment Share on other sites More sharing options...
PrateekSaxena Posted March 15, 2007 Share Posted March 15, 2007 Nice style of writing I must say Link to comment Share on other sites More sharing options...
nscnick Posted March 15, 2007 Author Share Posted March 15, 2007 Thanks for the pointers. I had seen this but it doesn't force decimal places, (much as an Excel cell can). I think I can do it in VB but don't know if it is possible to spawn out to another file within js.I have tried using two decimal places in default figures but if an integer is put in (such as ordering a qty of an item) then the result ends up as an integer or one decimal place.The problem is that I want to display the result of a currency calculation, which needs the minor units. Link to comment Share on other sites More sharing options...
jesh Posted March 15, 2007 Share Posted March 15, 2007 Did you see pulpfiction's posting in the HTML forum regarding the toFixed method?http://w3schools.invisionzone.com/index.ph...ost&p=63339See also:http://www.pageresource.com/jscript/j_a_03.htm Link to comment Share on other sites More sharing options...
nscnick Posted March 17, 2007 Author Share Posted March 17, 2007 Did you see pulpfiction's posting in the HTML forum regarding the toFixed method?http://w3schools.invisionzone.com/index.ph...ost&p=63339See also:http://www.pageresource.com/jscript/j_a_03.htm Yes thanks, it was me. I wasn't sure if there was an html solution as an alternative. However I did find out that the method turns a number into a string!Problem now solved, thanks for all help. 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