XWidgetSoft Forum
https://www.bbs.xwidget.com/

help: limit digits after comma
https://www.bbs.xwidget.com/viewtopic.php?f=8&t=4394
Page 1 of 1

Author:  Oletik [ April 18th, 2014, 6:08 am ]
Post subject:  help: limit digits after comma

Can somebody help me with problem? How to write code to limit digits after comma for text which show result of some mathematical calculation? I have "1750,3333333333", I need "1750.33".
Thanks.

Author:  Jimking [ April 18th, 2014, 6:28 am ]
Post subject:  Re: help: limit digits after comma

Topic moved to the right section. Please next time check better the section that you post.

Author:  qiancang [ April 18th, 2014, 7:01 am ]
Post subject:  Re: help: limit digits after comma

var r = 100/3; //33.333333333
text1.text = r.toFixed(2); // 33.33
text2.text = r.toFixed(3); // 33.333

Author:  meme [ April 18th, 2014, 2:29 pm ]
Post subject:  Re: help: limit digits after comma

For more info and examples checkout http://www.w3schools.com/jsref/jsref_tofixed.asp

Author:  Oletik [ April 19th, 2014, 7:41 am ]
Post subject:  Re: help: limit digits after comma

Thank you very much for your help! It works OK

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/