zkaung
11-15-2005, 10:55 PM
if I want to convert 18.99555 to number that have 2 digit how can I do ?
I use Number(18.99555).toFixed(2) it's not work.
javatis
11-16-2005, 07:02 AM
an fast and dirty way would be->
<view id="myMethodView">
<method name="myExpMethod" args="myNumber, myExp">
myNumber=Math.round(myNumber*Math.pow(10, myExp));
myNumber=myNumber/Math.pow(10, myExp);
return(myNumber)
</method>
</view>
Edit :
ajh i forgot u can herin choose also the count of numbers behind the .
so u would call the method for ur needs like
myMethodView.myExpMethod(18.95555, 2)
greetz
Sascha
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.