Sujay's Free Tools(GST calculator tool)
Below is a simple example of a GST Calculator tool using HTML, CSS, and JavaScript. I've included some basic styling for responsiveness, and I'm using the Bootstrap library for styling.<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>GST Calculator</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
<style>
body {
background-color: #f8f9fa;
}
.calculator {
max-width: 400px;
margin: 50px auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
</style>
</head>
<body>
<div class="calculator">
<h2 class="text-center">GST Calculator</h2>
<div class="form-group">
<label for="originalAmount">Original Amount:</label>
<input type="number" class="form-control" id="originalAmount" placeholder="Enter amount">
</div>
<div class="form-group">
<label for="gstRate">GST Rate (%):</label>
<input type="number" class="form-control" id="gstRate" placeholder="Enter GST rate">
</div>
<button class="btn btn-primary btn-block" onclick="calculateGST()">Calculate GST</button>
<div class="mt-3">
<h4>Result:</h4>
<p id="result">GST Amount: $0.00<br>Total Amount: $0.00</p>
</div>
</div>
<script>
function calculateGST() {
var originalAmount = parseFloat(document.getElementById('originalAmount').value);
var gstRate = parseFloat(document.getElementById('gstRate').value);
if (!isNaN(originalAmount) && !isNaN(gstRate)) {
var gstAmount = (originalAmount * gstRate) / 100;
var totalAmount = originalAmount + gstAmount;
document.getElementById('result').innerHTML = "GST Amount: $" + gstAmount.toFixed(2) + "<br>Total Amount: $" + totalAmount.toFixed(2);
} else {
document.getElementById('result').innerHTML = "Please enter valid numbers.";
}
}
</script>
<!-- Bootstrap JS and Popper.js -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>Make sure to test and adjust the code according to your requirements. You can further enhance the styling and functionality based on your preferences.
Comments
Post a Comment