-
Notifications
You must be signed in to change notification settings - Fork 0
/
login2.js
21 lines (15 loc) · 905 Bytes
/
login2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function validateForm(event) {
event.preventDefault(); // Prevent form submission to the server
const username = document.getElementById('username').value.trim();
const password = document.getElementById('password').value.trim();
// You can add more complex validation and authentication logic here
// For simplicity, let's assume the username is 'user' and the password is 'password'
if (username === 'user' && password === 'password') {
alert('Login successful! Redirecting to thank you page.');
window.location.href = 'thankyou.html'; // Replace 'thankyou.html' with the actual filename of your thank you page
} else {
alert('Invalid username or password. Please try again.');
}
}
// Add an event listener to handle login form submission
document.getElementById('loginForm').addEventListener('submit', validateForm);