Jonny5uk
01-29-2003, 12:47 PM
Hi there,
I'm having some real trouble with what seems to be a simple issue. I have spent hours looking at tutorials, but am a bit of a newbie with javascript and could really do with some help.
Here's the problem...
I am building a weather convertor, which simply changes mm into inches and vice versa for a rainfall conversion.
This works fine, but i can seem to round the results. I was wondering if this due and an error in my code or whether I need to declare any particular variables in the beginning.
Here's a snippet from the button in the code which generates the answer, where it won't work...
<input name=mm
onChange= "Math.round(4.56789)) inches.value = this.value/25.4" size=8>
</font> </div></td>
<td><div align="center"> </div></td>
<td><div align="center"><font size="2" face="Arial, Helvetica">
<input name=inches
onChange="mm.value = this.value * 25.4" size=8>
</font> </div></td>
<td><div align="center"> </div></td>
<td> </td>
<td><font size="2" face="Arial, Helvetica">
<input name="button322" type=button onClick=(this.value) value=Convert>
<input name="Clear2" type="reset" id="Clear2" value="Clear">
The above code is for 2 entry fields and two buttons. In one (top) I have tried to enter math.round code, the other I have not.
I haven't declared any math.round variables in the header, as not sure how to/or if I have to.
As you can see, I'm pretty lost and any help would be much appreciated !!
Thanks in advance
Jon
I'm having some real trouble with what seems to be a simple issue. I have spent hours looking at tutorials, but am a bit of a newbie with javascript and could really do with some help.
Here's the problem...
I am building a weather convertor, which simply changes mm into inches and vice versa for a rainfall conversion.
This works fine, but i can seem to round the results. I was wondering if this due and an error in my code or whether I need to declare any particular variables in the beginning.
Here's a snippet from the button in the code which generates the answer, where it won't work...
<input name=mm
onChange= "Math.round(4.56789)) inches.value = this.value/25.4" size=8>
</font> </div></td>
<td><div align="center"> </div></td>
<td><div align="center"><font size="2" face="Arial, Helvetica">
<input name=inches
onChange="mm.value = this.value * 25.4" size=8>
</font> </div></td>
<td><div align="center"> </div></td>
<td> </td>
<td><font size="2" face="Arial, Helvetica">
<input name="button322" type=button onClick=(this.value) value=Convert>
<input name="Clear2" type="reset" id="Clear2" value="Clear">
The above code is for 2 entry fields and two buttons. In one (top) I have tried to enter math.round code, the other I have not.
I haven't declared any math.round variables in the header, as not sure how to/or if I have to.
As you can see, I'm pretty lost and any help would be much appreciated !!
Thanks in advance
Jon