Tool Script for GST Calculator in html css java

GST (Goods and Services Tax) calculator tool script

Tool Script for GST Calculator in html css java


<!DOCTYPE html>

<html>

<head>

  <title>GST Calculator</title>

  <style>

    body {

      font-family: Arial, sans-serif;

      background-color: #f2f2f2;

      margin: 0;

      padding: 20px;

    }


    .container {

      max-width: 400px;

      margin: 0 auto;

      background-color: #fff;

      padding: 20px;

      border-radius: 5px;

      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);

    }


    h1 {

      text-align: center;

    }


    label {

      display: block;

      margin-bottom: 10px;

      font-weight: bold;

    }


    input[type="number"] {

      width: 100%;

      padding: 10px;

      border: 1px solid #ccc;

      border-radius: 4px;

    }


    .result {

      margin-top: 20px;

      font-weight: bold;

    }


    .btn {

      display: inline-block;

      background-color: #4CAF50;

      color: #fff;

      text-decoration: none;

      padding: 10px 20px;

      border-radius: 4px;

      cursor: pointer;

    }

  </style>

</head>

<body>

  <div class="container">

    <h1>GST Calculator</h1>

    <label for="amount">Enter Amount:</label>

    <input type="number" id="amount" placeholder="Amount" step="0.01" required>

    <label for="gstRate">GST Rate (%):</label>

    <input type="number" id="gstRate" placeholder="GST Rate" step="0.01" required>

    <button class="btn" onclick="calculateGST()">Calculate</button>

    <div class="result" id="result"></div>

  </div>


  <script>

    function calculateGST() {

      var amount = parseFloat(document.getElementById("amount").value);

      var gstRate = parseFloat(document.getElementById("gstRate").value);


      var gstAmount = (amount * gstRate) / 100;

      var totalAmount = amount + gstAmount;


      document.getElementById("result").innerHTML = "GST Amount: $" + gstAmount.toFixed(2) + "<br>Total Amount (including GST): $" + totalAmount.toFixed(2);

    }

  </script>

</body>

</html>


Post a Comment

0 Comments