Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2010
    Thanked 0 Times in 0 Posts

    Multiplying two input fields


    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

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,743 Times in 4,705 Posts
    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?)
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts