-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
27 lines (22 loc) · 793 Bytes
/
script.js
File metadata and controls
27 lines (22 loc) · 793 Bytes
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
// Welcome button alert
function showAlert() {
alert("Welcome to my SEN 313 personal profile website!");
}
// Contact form handling
document.getElementById("contactForm").addEventListener("submit", function (e) {
e.preventDefault();
let name = document.getElementById("name").value;
let response = document.getElementById("response");
response.textContent = "Thank you, " + name + "! Your message has been received.";
response.style.color = "green";
// Clear form
this.reset();
});
// Smooth scrolling
document.querySelectorAll("nav a").forEach(link => {
link.addEventListener("click", function (e) {
e.preventDefault();
document.querySelector(this.getAttribute("href"))
.scrollIntoView({ behavior: "smooth" });
});
});