I am trying to use an html form to accept my user input then do the calculations on javascript, it just displays the dialogue box without the calculations, what could be the problem? I don't know how to go about it, this is what I tried so far.
Javascript
<script type="text/javascript">
function Air() {
input = document.getElementById('Enter').value;
TotalPurchasingAmountOrange = 0.87 * input;
discountOrange = 0.13 * input;
TotalPurchasingAmountMascom = 0.85 * input;
discountMascom = 0.15 * input;
TotalPurchasingAmountBMobile = 0.83 * input;
discountMascom = 0.17 * input;
alert("Orange airtime:\nAmount: " + TotalPurchasingAmountOrange + "\nDiscount: " + discountOrange);
alert("Mascom airtime:\nAmount: " + TotalPurchasingAmountMascom + "\nDiscount: " + discountMascom + "\nBMobile airtime:\nAmount: " + TotalPurchasingAmountBMobile + "\nDiscount: " + discountBMobile);
}
</script>
Form
<ul>
<li>
<label>Units
<input type="text" data-bind="value: units" />
</label>
</li>
</ul>
<div class="buttonArea">
<input id="Enter" type="button" value="Enter" onclick="Air()" />
</div>