Hello,

I'm trying to use Javascript to enhance a few features of my site.
I've wrote a fewlines that will convert two textboxes between cm and inches interchangeably.

However, I would also like to round the result to make it easier to read.

i.e. Entering Inches = 1.4
Yields cm = 3.5559999999999996
Whereas it should really read cm = 3.556, or even 3.56

In the code below I tried changing the line

Code:
ONKEYUP="document.convert.ins.value = (1/2.54) * document.convert.cms.value" 

to

ONKEYUP="document.convert.ins.value = Math.round((1/2.54) * document.convert.cms.value)"
Here's my code:

Code:
 <FORM ACTION="#" NAME="convert" >
Enter Inches
<INPUT TYPE=TEXT NAME="ins"
    ONKEYUP=" document.convert.cms.value = 2.54 * document.convert.ins.value" 
	
	>
<BR><BR>
<INPUT TYPE=TEXT NAME="cms" 
    ONKEYUP="document.convert.ins.value = (1/2.54) * document.convert.cms.value" 

	>
centimetres
</FORM>
Thanks in advance!