i am using a java script as a calculator to multiply 3 seperate numbers
problem is when i get an answer it needs to be.. how can i put it .. made up to anouther number within a range
heres what i meen
Lets say the anser to the sum is
32
it falls within a range of lets say 30 to 40
I want to the answer to then be 40 so the number is then rounded up to 40
here is what i have so far
the php bits are numbers taken from a database so ignore them
<FORM>
<SCRIPT language="javascript">
function calculator (form){
form.answer.value = form.height.value * form.width.value * form.price.value
}
</SCRIPT>
<TABLE>
<TR>
<TD>price per sqm</TD>
<TD><label>
£ <? echo $row['price'] ?> per square meter <input name="price" type="hidden" id="price" value="<? echo $row['price']*0.010; ?>" />
</label></TD>
</TR>
<TR>
<TD>width cm</TD>
<TD><label>
<input name="width" type="text" id="width" size="15" />
</label></TD>
</TR>
<TR>
<TD>height cm</TD><TD><INPUT NAME="height" TYPE ="text" id="height" SIZE=15></TD></TR>
<TR><TD><INPUT TYPE ="button" VALUE="Calculate" ONCLICK="calculator(this.form)"></TD></TR>
<TR><TD>Your price for your blind is:</TD><TD><INPUT NAME="answer" TYPE="text" id="answer" SIZE=4 >
</TD></TR>
</TABLE>
</FORM>
I want the anser in the box to be rounded up
Would i use an " if " statment and if so how would i do it..
lets say the answer was 12 i want it rounded up to 20
but if the answer is 21 i want it rounded up to 25
any help would be great and thanks in advance Very Happy


