-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
34 lines (28 loc) · 1.21 KB
/
script.js
File metadata and controls
34 lines (28 loc) · 1.21 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
document.addEventListener('DOMContentLoaded', function() {
// Highlight current page in navigation
const currentPage = location.pathname.split('/').pop();
const navLinks = document.querySelectorAll('.menu li a');
navLinks.forEach(link => {
if (link.getAttribute('href') === currentPage) {
link.classList.add('active');
} else {
link.classList.remove('active');
}
});
// Handle contact form submission
const contactForm = document.getElementById('contact-form');
if (contactForm) {
contactForm.addEventListener('submit', function(event) {
event.preventDefault();
// Get form values
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
// Show success message
alert(`Terima kasih ${name}! Pesan Anda telah terkirim. Kami akan menghubungi Anda di ${email} segera.`);
// Reset form
contactForm.reset();
});
}
// Simulate loading content for demonstration
console.log('Blog loaded successfully!');
});