Untitled
// Carousel Logic let index = 0; const slides = document.querySelectorAll('.carousel-item'); function showSlide() { slides.forEach((slide, i) => { slide.style.transform = `translateX(${(i - index) * 100}%)`; }); } function nextSlide() { index = (index + 1) % slides.length; showSlide(); } setInterval(nextSlide, 3000); // Registration Form Logic document.getElementById('registerForm').addEventListener('submit', function(event) { event.preventDefault(); const firstName = document.getElementById('firstName').value; const lastName = document.getElementById('lastName').value; const email = document.getElementById('email').value; const password = document.getElementById('password').value; const confirmPassword = document.getElementById('confirmPassword').value; const goal = document.getElementById('goal').value; if (password !== confirmPassword) { alert('Passwords do not match'); return; } const userDetails = { firstName, lastName, email, password, goal, }; localStorage.setItem('userDetails', JSON.stringify(userDetails)); document.getElementById('message').textContent = 'You have successfully registered!'; });
Leave a Comment