-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
26 lines (24 loc) · 1.06 KB
/
script.js
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
document.addEventListener('DOMContentLoaded', function() {
// If on the welcome page, display the welcome message
if (document.getElementById('welcomeMessage')) {
const urlParams = new URLSearchParams(window.location.search);
const username = urlParams.get('username');
if (username) {
document.getElementById('welcomeMessage').textContent = `Welcome, ${username}!`;
} else {
document.getElementById('welcomeMessage').textContent = 'Welcome!';
}
}
// Example validation before submitting the login form (client-side)
const loginForm = document.getElementById('loginForm');
if (loginForm) {
loginForm.addEventListener('submit', function(event) {
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
if (!username || !password) {
alert('Please fill in all fields.');
event.preventDefault();
}
});
}
});