JSFiddle - React, Tailwind, and code Playground

JavaScript

function Recount(theform) {
var cenac1 = 0;
theform.cenac1.value = parseInt(theform.ks1.value) * parseInt(theform.cenap1.value);
 
var cenac2 = 0;
theform.cenac2.value = parseInt(theform.ks2.value) * parseInt(theform.cenap2.value);






if (parseInt(document.getElementById("celkem").value) < 485) {
        document.getElementById("doprava1").value = "29";
    } else {
        document.getElementById("doprava1").value = "37";
    }


theform.celkem.value = parseInt(theform.cenac1.value) + parseInt(theform.cenac2.value) + parseInt(document.getElementById("doprava1").value);

}