added some error handling

This commit is contained in:
2021-11-27 14:12:20 +01:00
parent b693aa5bf5
commit 1f881cb771
2 changed files with 19 additions and 15 deletions

View File

@@ -3,7 +3,7 @@ buttoncalc.addEventListener("click", calculate)
function calculate(){
let aromaamount = document.getElementById("aromaamount").value
let aromaconc = document.getElementById("aromaconc").value
let aromaconc = document.getElementById("aromaconc").value / 100
let vg = document.getElementById("vg").value
let pg = document.getElementById("pg").value
let other = document.getElementById("other").value
@@ -13,6 +13,10 @@ function calculate(){
let nicshotvg = document.getElementById("nicshotvg").value
let nicshotpg = document.getElementById("nicshotpg").value
if(vg * 1 + pg * 1 + other * 1 != 100){
} else if(nicshotvg * 1 + nicshotpg * 1 != 100){
} else {
document.getElementById("results").style.display="block"
let volume = aromaamount / aromaconc
let countnicshot = (volume * nicdose) / (nicshotamount * nicshotnicppm)
@@ -26,4 +30,4 @@ function calculate(){
document.getElementById("amountvg").value = amountvg
document.getElementById("amountpg").value = amountpg
}
}

View File

@@ -12,7 +12,7 @@
<td><input type="text" id="aromaamount" name="aromaamount"></td>
</tr>
<tr>
<td><label for="aromaconc"> Aromakonzentration:</label></td>
<td><label for="aromaconc"> Aromakonzentration in %:</label></td>
<td><input type="text" id="aromaconc" name="aromaconc"></td>
</tr>
<tr>