-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
39 lines (30 loc) · 1.4 KB
/
script.js
File metadata and controls
39 lines (30 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
document.querySelector('.cta-btn').addEventListener('click', () => {
window.location.href = "welcome.html"; // Redirect to welcome page after successful login
});
document.querySelector('.contact-btn').addEventListener('click', () => {
alert('Contact form coming soon!');
});
const loginForm = document.getElementById('loginForm');
const statusMessage = document.getElementById('statusMessage');
// Handle form submission
loginForm.addEventListener('submit', (e) => {
e.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
// Mock login success
statusMessage.textContent = `Welcome, ${username}! You are now logged in.`;
statusMessage.style.color = 'green';
// Save login state (optional)
localStorage.setItem('username', username);
localStorage.setItem('loggedIn', true);
// Simulate navigation to a dashboard or other page
setTimeout(() => {
alert('Redirecting to the dashboard...');
// Replace this with an actual page redirect if necessary:
setTimeout(() => {
alert('Redirecting to the welcome page...');
// Replace this line to redirect to welcome.html after login:
window.location.href = "welcome.html"; // Redirect to welcome page
}, 1000);
}, 1000);
});