|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
round to 2 decimal
having trouble making this code work for two decimals 35.50 is what i am trying to get
function doit(){var a = eval (document.ratio.a.value)var b = eval (document.ratio.b.value)var c = eval (document.ratio.c.value) document.ratio.c.value=(a - b)/ a *100} need sime help to round to 2 decimal places using this code |
|
#2
|
||||
|
||||
|
To round with javascript:
var result, roundme; roundme = 8.111111; result = Math.round( roundme * 1000) / 1000 //returns 8.111 This will round to the 3rd decimal place. |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > round to 2 decimal |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|