Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Javascript Calculation form add checkbox and automatic calculation

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #36227

    I have created a very simple calculator for the price of graden studio and I am want to replace the drop down to checkboxes and I would like the prices to be automatically created with out having to click the calculate button.

    Any Help will be great.

    Here is my javascript

    function temp(form)
    {
    var l = parseFloat(form.Length.value, 10);
    var w = parseFloat(form.Width.value, 10);
    var lam = parseFloat(form.Laminate.value, 10);
    var dec = parseFloat(form.Decking.value, 10);
    var oak = parseFloat(form.oak.value, 10);
    var bi = parseFloat(form.bifold.value, 10);
    var open = parseFloat(form.oakopening.value, 10);
    var slide = parseFloat(form.sliding.value, 10);
    var pic = parseFloat(form.picture.value, 10);
    var alopen = parseFloat(form.alopening.value, 10);
    var elc = parseFloat(form.electric.value, 10);
    var clad = parseFloat(form.cladding.value, 10);
    var light = parseFloat(form.downlights.value, 10);
    var fou = parseFloat(form.foundation.value, 10);
    var del = parseFloat(form.delivery.value, 10);


    var t = 0;
    var sm = 0;
    sm = l * w;
    et = (lam * sm) + dec + oak + bi + open + slide + pic + alopen + elc + (clad * sm) + light + del +fou;
    bt = sm * 600 ;
    vt = bt + et;
    vit = vt * 1.2;
    form.SquareM.value = sm;
    form.StandardTotal.value = bt;
    form.BasicTotal.value = bt;
    form.ExtrasTotal.value = et;
    form.VatTotal.value = vt;
    form.VatInTotal.value = vit;
    }

    Here is my html

         


    Enter Length:


    Enter Width:


    Square metres :





    £
    is the standard cost; now add in any optional extras from list below





    Standard Specification



    • Steel box base frame


    • SIPS Wall construction 151mm


    • SIPS Floor construction


    • SIPS Roof construction


    • UPVC doors standard


    • Plastered internal finish


    • Or melamine internal finish


    • Protected vapour barrier


    • EPDM roof covering


    • Guttering and downpipe


    • Pressure treated cladding



    • Carpet tiles


    • Standard floor to eves height 2.5ms


    • Delivery to site free within 100mile
      radius of HD4







    Optional Extras




    Laminate Flooring psm:








    0.5m deep front decking:




    Oak Picture window 760 x 1950:




    Oak Bi-fold doors 1800 x 2100:




    Oak opening window 1200 x 795:




    Aluminium Sliding door 1800 x 2100:




    Aluminium picture window 760 x 2100 :





    Aluminium opening window 900 x 450 :




    Electric pack – lights, sockets, fuse box :





    Western Red Cedar Cladding psm :




    Exterior downlights 4 :




    Foundations for steel box frame :




    Delivery over 100m up to 300m radius :




    onClick=temp(this.form)>







    Total Standard Specification £


    Total Optional Extras £


    Total for your Garden Room £
    (exc vat)


    Total for your Garden Room £
    (inc vat)

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.