google-site-verification=mCpQdwnFsIhcsA-5wCmas8Sf1a6s6PeFC5JrFME-NNA Time Calculator Skip to main content

Featured

YouTube Subscriber and Liker Button

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; }

Time Calculator

Time Calculator

Time Calculator

Result:

body { background-color: #f8f9fa; } .container { margin-top: 50px; } #result { font-size: 24px; } .btn-primary { background-color: #007bff; border-color: #007bff; } .btn-primary:hover { background-color: #0069d9; border-color: #0062cc; } document.getElementById('calculateBtn').addEventListener('click', function() { var time1 = document.getElementById('time1').value; var time2 = document.getElementById('time2').value; var time1Parts = time1.split(':'); var time2Parts = time2.split(':'); var hours1 = parseInt(time1Parts[0]); var minutes1 = parseInt(time1Parts[1]); var hours2 = parseInt(time2Parts[0]); var minutes2 = parseInt(time2Parts[1]); var totalHours = hours1 + hours2; var totalMinutes = minutes1 + minutes2; if (totalMinutes >= 60) { totalHours += Math.floor(totalMinutes / 60); totalMinutes %= 60; } document.getElementById('result').textContent = totalHours + ' hours ' + totalMinutes + ' minutes'; }); This code creates a simple time calculator where you input two times, and it calculates the total hours and minutes. The result is displayed when you click the "Calculate" button.

Comments

Popular Posts