-
Notifications
You must be signed in to change notification settings - Fork 0
/
discount.html
100 lines (90 loc) · 4.14 KB
/
discount.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
95
96
97
98
99
100
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Discount Calculator - Calculate total discount and Cost price</title>
<meta name="description"
content="Easily calculate your discount amount and price after discount in real time right at your fingertips online." />
<meta name="keywords"
content="discount calculator, real time discount calculator, price after discount, cost price calculator,real time" />
<link rel="shortcut icon" href="./images/discount.webp" type="image/x-icon">
<link rel="stylesheet" href="./styles.css">
<link rel="stylesheet" href="./footer.css">
</head>
<body>
<nav>
<div class="menu-toggle" onclick="toggleMenu()">
<span></span>
<span></span>
<span></span>
</div>
<div class="nav-links">
<a href="./index.html">Home</a>
<a href="./data.html">Data <span id="converterText">Converter</span></a>
<a href="./length.html">Length <span id="converterText">Converter</span></a>
<a href="./time.html">Time <span id="converterText">Converter</span></a>
<a href="./mass.html">Mass <span id="converterText">Converter</span></a>
<a href="./temperature.html">Temperature <span id="converterText">Converter</span></a>
<a href="./numbersystem.html">Number System <span id="converterText">Converter</span></a>
<a href="./discount.html" class="bb">Discount <span id="converterText">Calculator</span></a>
<a href="./power.html">Power mod <span id="converterText">Calculator</span></a>
<a href="./text.html">Text Styler</a>
</div>
</nav>
<div class="container">
<img src="./images/discount.webp" alt="Data" class="description-image">
<h1>Discount Calculator</h1>
<p>Enter the original price and discount percentage.<br>It will automatically calculate the result.</p>
<div>
<label for="original-price">Original Price</label><br>
<input type="number" placeholder="Enter original amount" title="Enter original price" id="original-price">
</div>
<br>
<div>
<label for="discount-percentage">Discount percentage</label> <br>
<input type="number" placeholder="Enter discount percentage" title="Enter discount percentage"
id="discount-percentage">
</div>
<br>
<div class="convert-logo-div">
<img src="./images/animated/discount.gif" alt="Convert" class="description-image">
</div>
<p id="after-amount">Save amount : 0.00<br> Amount after discount : 0.00</p>
</div>
<footer>
<div class="footer-container">
<div class="footer-info">
<p>© 2024 Arun Neupane. All rights reserved.</p>
<p>Made with ❤️ by Arun Neupane</p>
</div>
<div class="footer-links">
<a href="./about.html">About</a>
<a href="./privacy.html">Privacy Policy</a>
<a href="./contact.html">Contact</a>
</div>
</div>
</footer>
<script src="nav.js"></script>
<script>
const originalPrice = document.getElementById('original-price');
const discountPercentage = document.getElementById("discount-percentage");
const afterAmount = document.getElementById('after-amount');
originalPrice.addEventListener("keyup", () => {
if (discountPercentage.value != "") {
afterDiscount(originalPrice.value, discountPercentage.value);
}
});
discountPercentage.addEventListener("keyup", () => {
if (originalPrice.value != "") {
afterDiscount(originalPrice.value, discountPercentage.value);
}
});
function afterDiscount(op, dp) {
let discount = op * dp / 100;
let after = op - discount;
afterAmount.innerHTML = "Discount amount: " + discount + "<br>" + "Price after discount : " + after;
}
</script>
</body>
</html>