3 Replies Latest reply on Jul 19, 2013 5:59 AM by CtDave

    JavaScript Calculations for Quoting Customers with html Website...?

    iMaddBoxx

      Hi I am new to JavaScript, but I know there is a way to do math with it.

       

      What I am trying to do is: with html have 2 <input> tags (lets say the ID's will be "box1" & "box2")

       

      the customer visiting the site would then type into the 2 boxes their measurments, IF the 2 measurments calculate between 0-1400 square inches the quoted price would then display at $512.00 (which I would need to generate in another uneditable box/tag, not sure if I would use another input - unless I made it uneditiable somehow - or if it would automatically generate in some kind of js tag - like I said I am new to this so please bare with me)

       

      Then I will need to add a series of... strings? (I think is what they would be called...):

       

      IF the 2 measurments calculate between 1401-1700 square inches the price would calculate to $539.00

      IF the 2 measurments calculate between 1701-2000 square inches the price would calculate to $566.00

      IF the 2 measurments calculate between 2001-2300 square inches the price would calculate to $592.00

      IF the 2 measurments calculate between 2301-2600 square inches the price would calculate to $625.00

      IF the 2 measurments calculate between 2601-2900 square inches the price would calculate to $657.00

       

       

      and I would need to add about 20 more lines of the above pattern... I am guessing I could just copy/paste each IF statement if I had enough of that coded.

       

      I could either link the js page with this code to the website I am building, or add it directly to the webpage using the <script> tag, what would you recommend?

       

      I am working on a Mac, with dreamweaver CS6 - this would need to be compatible for IE especially, and all other browsers.