Untitled
unknown
plain_text
9 days ago
825 B
2
Indexable
Never
// Carousel Functionality let currentSlide = 0; const slides = document.querySelectorAll('.carousel .slide'); function showSlide(index) { slides.forEach((slide, i) => { slide.style.display = i === index ? 'block' : 'none'; }); } function nextSlide() { currentSlide = (currentSlide + 1) % slides.length; showSlide(currentSlide); } setInterval(nextSlide, 3000); // Change slide every 3 seconds // Custom Validation for Registration Form document.querySelector('form').addEventListener('submit', function(event) { const name = document.getElementById('name').value; const email = document.getElementById('email').value; if (!name || !email) { alert('All fields are required!'); event.preventDefault(); } else { alert('Form submitted successfully!'); } });
Leave a Comment