functionality should be complete, error checking is still needed
This commit is contained in:
16
aromacalc.js
16
aromacalc.js
@@ -1,3 +1,6 @@
|
|||||||
|
let buttoncalc = document.getElementById("calculate")
|
||||||
|
buttoncalc.addEventListener("click", calculate)
|
||||||
|
|
||||||
function calculate(){
|
function calculate(){
|
||||||
let aromaamount = document.getElementById("aromaamount").value
|
let aromaamount = document.getElementById("aromaamount").value
|
||||||
let aromaconc = document.getElementById("aromaconc").value
|
let aromaconc = document.getElementById("aromaconc").value
|
||||||
@@ -9,5 +12,18 @@ function calculate(){
|
|||||||
let nicshotnicppm = document.getElementById("nicshotnicppm").value
|
let nicshotnicppm = document.getElementById("nicshotnicppm").value
|
||||||
let nicshotvg = document.getElementById("nicshotvg").value
|
let nicshotvg = document.getElementById("nicshotvg").value
|
||||||
let nicshotpg = document.getElementById("nicshotpg").value
|
let nicshotpg = document.getElementById("nicshotpg").value
|
||||||
|
|
||||||
|
document.getElementById("results").style.display="block"
|
||||||
|
let volume = aromaamount / aromaconc
|
||||||
|
let countnicshot = (volume * nicdose) / (nicshotamount * nicshotnicppm)
|
||||||
|
let amountothers = volume / 100 * other
|
||||||
|
let amountvg = volume / 100 * vg - countnicshot * nicshotamount * nicshotvg / 100
|
||||||
|
let amountpg = volume / 100 * pg - countnicshot * nicshotamount * nicshotpg / 100 - aromaamount
|
||||||
|
|
||||||
|
document.getElementById("volume").value = volume
|
||||||
|
document.getElementById("countnicshot").value = countnicshot
|
||||||
|
document.getElementById("amountothers").value = amountothers
|
||||||
|
document.getElementById("amountvg").value = amountvg
|
||||||
|
document.getElementById("amountpg").value = amountpg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -55,7 +55,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
</table>
|
</table>
|
||||||
<button name="calculate" type="button">Berechne</button>
|
<button id="calculate" type="button">Berechne</button>
|
||||||
<table style="display:none" id="results">
|
<table style="display:none" id="results">
|
||||||
<caption>Ergebnisse:</caption>
|
<caption>Ergebnisse:</caption>
|
||||||
<tr>
|
<tr>
|
||||||
|
Reference in New Issue
Block a user