simple javascript problem

Associate
Joined
6 Jul 2007
Posts
431
Location
Notts, UK
Hi,

basically i have the formula W x G x Cos (A) = T

I need 3 fields to enter the values to calculate T

I have the following code but it doesn't work

Code:
<form>
Weight of Object to be supported: <input name="weight" /><br/>
Distance to Center of mavity: <input name="mavity" /><br/>
Angle <input name="angle" /><br/>
Torque: <input name="torque" readonly /><br/>


<input type="button" value="Calculate Torque"
  onclick="this.form.torque.value = this.form.weight.value * this.form.mavity.value * math.cos(this.form.angle.value);" />
</form>
 
Code:
onclick="javascript:this.form.torque.value = this.form.weight.value * this.form.mavity.value * Math.cos(this.form.angle.value);" />

I think it should look like that. Math not math.
 
Back
Top Bottom