C#

Design Zakat Calculator using Java Script

Design Zakat Calculator using Java Script:

Don’t forget to add Java script online/off line files in project, without Java script files it will not work. Add script in a single file or manage it as you wish.

<script>
function Calculator() {

var a = $(‘.a’).val(); if (a === “”){a = 0;}
var b = $(‘.b’).val(); if (b === “”) {b = 0;}
var c= $(‘.c’).val();if (c === “”){c = 0;}
var d = $(‘.d’).val();if (d === “”){d = 0;}
var zakat = 2.5; var n = 100; var e = parseInt(a) + parseInt(b) + parseInt(c) + parseInt(d); var result = e * zakat / n;
$(‘.total’).val(result);
}
</script>

HTML Form for Input from User:

<form name=”cal” action=””>
<label>1</label>
<input class=”a” type=”text” name=”a” value=”0″ /></br>
<label>2</label>
<input class=”b” type=”text” name=”b” value=”0″/></br>
<label>3</label>
<input class=”c” type=”text” name=”c” value=”0″/></br>
<label>4</label>
<input class=”d” type=”text” name=”d” value=”0″/></br>

<input type=”button” value=”Submit” name=”Submit” onclick=”Calculator()” />
</form>
<h1>Total: <input type=”textbox” name=”” class=”total” value=””></h1>

Leave a Comment