output only 2 decimal places
I have some code in which a user enters a number and depending on the scope of the number different functions are called when they click the solve button. This is done using the function below, I have also put the code at the bottom relating to the solve button.
How can I get the output to show only two decimal places?????
function inputtest(form) {
var val = "-" + tonum(form.inField.value);
var result;
if (val <=-6 && val >=-20) {
result = solve_quad(val);
}
else {
if (val<=-20 && val >=-50) {
result = solve_quad2(val);
}
else {
if (val<-50) {
result = solve_quad3(val);
}
}
}
form.outField.value = result;
}
The code I have for the output is as follows
<input type="button" name="btn12" value="Solve" onClick="inputtest(this.form)" />
|