-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvat.html
More file actions
28 lines (28 loc) · 843 Bytes
/
Copy pathvat.html
File metadata and controls
28 lines (28 loc) · 843 Bytes
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
<!doctype html>
<html>
<head>
<title>VAT Calculator</title>
<script>
function calculateVAT() {
var grossPrice = parseFloat(
document.getElementById("grossPrice").value,
);
var vatRate = 0.07;
var vatAmount = grossPrice * vatRate;
document.getElementById("vatAmount").textContent = vatAmount.toFixed(2);
document.getElementById("total").textContent = (
grossPrice + vatAmount
).toFixed(2);
}
</script>
</head>
<body>
<h1>VAT Calculator</h1>
<label for="grossPrice">Gross Price:</label>
<input type="number" id="grossPrice" step="0.01" />
<button onclick="calculateVAT()">Calculate VAT</button>
<br />
<div>Vat 7%: $<span id="vatAmount">0</span></div>
<p>Total: $<span id="total">0</span></p>
</body>
</html>