"Discover a treasure trove of productivity and creativity with our curated collection of free online tools! From project management to graphic design, coding to content creation, our website offers a one-stop destination for all your digital needs. Whether you're a seasoned professional or a budding enthusiast, unlock the power of innovation with intuitive interfaces and robust functionalities. Say goodbye to costly software and hello to efficiency without breaking the bank.
YouTube Subscriber and Liker Button Subscribe Like // Function to subscribe to a channel function subscribe() { alert("Subscribed!"); // You can add code here to interact with the YouTube API to subscribe to a channel } // Function to like a video function like() { alert("Liked!"); // You can add code here to interact with the YouTube API to like a video } // Event listeners for buttons document.getElementById("subscribeBtn").addEventListener("click", subscribe); document.getElementById("likeBtn").addEventListener("click", like); .container { text-align: center; margin-top: 50px; } button { padding: 10px 20px; font-size: 16px; border: none; border-radius: 5px; cursor: pointer; margin: 0 10px; } button:hover { background-color: #ddd; }
Get link
Facebook
X
Pinterest
Email
Other Apps
Gst calculator
GST Calculator
GST Calculator
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f0f0f0;
}
.calculator-container {
max-width: 400px;
margin: 50px auto;
padding: 20px;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h2 {
text-align: center;
color: #333;
}
.input-group {
margin-bottom: 15px;
}
.input-group label {
display: block;
margin-bottom: 5px;
color: #555;
}
.input-group input {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
#result {
margin-top: 20px;
font-weight: bold;
}
document.addEventListener('DOMContentLoaded', function () {
var calculateBtn = document.getElementById('calculate-btn');
calculateBtn.addEventListener('click', function () {
calculateGST();
});
});
function calculateGST() {
var amount = parseFloat(document.getElementById('amount').value);
var rate = parseFloat(document.getElementById('rate').value);
var resultElement = document.getElementById('result');
if (isNaN(amount) || isNaN(rate)) {
resultElement.innerText = 'Please enter valid numbers.';
return;
}
var gstAmount = (amount * rate) / 100;
var totalAmount = amount + gstAmount;
resultElement.innerHTML = `GST Amount: ₹${gstAmount.toFixed(2)} Total Amount (Including GST): ₹${totalAmount.toFixed(2)}`;
}
About this tool:
In this rewritten version, I've made the following improvements:
Used template literals for string interpolation in JavaScript for better readability.
Simplified the event listener attachment for the Calculate button.
Moved the retrieval of DOM elements into the calculateGST() function for better encapsulation.
Removed unnecessary duplication of event listener attachment by directly calling the calculateGST() function within the event listener.
Comments
Post a Comment