"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
"Colorful Stopwatch
Stopwatch
00:00:00
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f5f5f5;
}
.stopwatch {
text-align: center;
}
.display {
font-size: 2em;
margin-bottom: 20px;
color: #333;
}
.controls button {
padding: 10px 20px;
margin: 0 5px;
font-size: 16px;
cursor: pointer;
border: none;
border-radius: 5px;
font-family: Arial, sans-serif;
}
.start {
background-color: #4caf50;
color: white;
}
.stop {
background-color: #f44336;
color: white;
}
.reset {
background-color: #008CBA;
color: white;
}
let timer;
let hours = 0;
let minutes = 0;
let seconds = 0;
const display = document.querySelector('.display');
const startBtn = document.querySelector('.start');
const stopBtn = document.querySelector('.stop');
const resetBtn = document.querySelector('.reset');
function startTimer() {
startBtn.disabled = true;
stopBtn.disabled = false;
timer = setInterval(updateDisplay, 1000);
}
function stopTimer() {
startBtn.disabled = false;
stopBtn.disabled = true;
clearInterval(timer);
}
function resetTimer() {
clearInterval(timer);
hours = 0;
minutes = 0;
seconds = 0;
display.textContent = '00:00:00';
startBtn.disabled = false;
stopBtn.disabled = true;
}
function updateDisplay() {
seconds++;
if (seconds >= 60) {
seconds = 0;
minutes++;
}
if (minutes >= 60) {
minutes = 0;
hours++;
}
const displayHours = hours < 10 ? '0' + hours : hours;
const displayMinutes = minutes < 10 ? '0' + minutes : minutes;
const displaySeconds = seconds < 10 ? '0' + seconds : seconds;
display.textContent = `${displayHours}:${displayMinutes}:${displaySeconds}`;
}
About this code:
startBtn.addEventListener('click', startTimer);
stopBtn.addEventListener('click', stopTimer);
resetBtn.addEventListener('click', resetTimer);
This should now work correctly. The stopwatch should start, stop, and reset as expected, and the button colors have been adjusted accordingly. If you encounter any further issues, please let me know!
Comments
Post a Comment