-
Notifications
You must be signed in to change notification settings - Fork 0
/
index-01.html
94 lines (90 loc) · 1.84 KB
/
index-01.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Salary Calculator</title>
<style>
body{
margin-left: 50px;
}
.field{
margin-bottom: 10px;
}
label{
display: block;
}
#tdSalary{
color : red;
font-size: 20pt;
}
</style>
<script src="jquery-3.3.1.min.js"></script>
<script>
String.prototype.toInt = function() {
return parseInt(this, 10);
};
$(function(){
$('#btnCalculate').click(function(){
var basic = $('#txtBasic').val().toInt(),
hra = $('#txtHra').val().toInt(),
da = $('#txtDa').val().toInt(),
tax = $('#rangeTax').val().toInt();
var gross = basic + hra + da,
net = gross * ((100-tax)/100);
$('#tdBasic').html(basic);
$('#tdHra').html(hra);
$('#tdDa').html(da);
$('#tdTax').html(tax);
$('#tdSalary').html(net);
});
});
</script>
</head>
<body>
<h1>Salary Calculator</h1>
<hr>
<section>
<div class="field">
<label for="">Basic :</label>
<input type="number" id="txtBasic">
</div>
<div class="field">
<label for="">HRA :</label>
<input type="number" id="txtHra">
</div>
<div class="field">
<label for="">DA :</label>
<input type="number" id="txtDa">
</div>
<div class="field">
<label for="">Tax :</label>
<input type="range" id="rangeTax" min="0" max="30" value="0">
</div>
<div class="field">
<input type="button" value="Calculate" id="btnCalculate">
</div>
<div class="field">
<table>
<thead>
<tr>
<th>Basic</th>
<th>HRA</th>
<th>DA</th>
<th>Tax</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td id="tdBasic">[Basic]</td>
<td id="tdHra">[Hra]</td>
<td id="tdDa">[Da]</td>
<td id="tdTax">[Tax]</td>
<td id="tdSalary">[Salary]</td>
</tr>
</tbody>
</table>
</div>
</section>
</body>
</html>