I'm still new using Javascript I have some problem with calculation using javascript right now. The problem is it won't count.
Let me know which one I made mistake and how to solve it. I'm really sorry because this is my first time using javascript.
<script text="javascript">
var p = 0;
var b = 0;
var c = 0;
function calc() {
var p = document.getElementById("pokok").value;
var b = document.getElementById('bonus').value;
var c = document.getElementById('cut').value;
if (p == 'pokok') { }
total = p + b - c;
document.getElementById("total").value=total;
}
</script>
What I want to do from my code is
P + B - C = total
so basically 10 + 10 - 5 = 15