View Full Version : Multiplying two input fields

07-20-2010, 08:04 PM

I would like to create a form that calculates the area of a floor or wall. The user will input the length/height and width dimensions into two input fields and then click calculate.

I simply need a script that multiplies the two fields together and puts the answer in a third read-only field.

Any help much appriciated

Kind regards, Mike

Old Pedant
07-20-2010, 08:28 PM
Width: <input name="width" /><br/>
Length: <input name="length" /><br/>
Area: <input name="area" readonly /><br/>
<input type="button" value="Compute Area"
onclick="this.form.area.value = this.form.width.value * this.form.length.value;" />

This *should* be discussed in about chapter 1 or at most chapter 2 of your JavaScript textbook. (I assume this is homework?)