Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
51 lines (43 loc) · 1.88 KB
/
Copy pathscript.js
File metadata and controls
51 lines (43 loc) · 1.88 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
40
41
42
43
44
45
46
47
48
49
50
51
// SOMARS Website JavaScript
// This file contains basic interactivity for the website
// Wait for the DOM to fully load
document.addEventListener('DOMContentLoaded', function() {
console.log('SOMARS website loaded successfully!');
// Handle contact form submission
const contactForm = document.getElementById('contactForm');
if (contactForm) {
contactForm.addEventListener('submit', function(e) {
e.preventDefault();
// Get form values
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const message = document.getElementById('message').value;
// Display alert (in a real application, you would send this to a server)
alert(`Thank you, ${name}! Your message has been received.\n\nNote: This is a demo form. To make it functional, connect it to a backend service or email API.`);
// Reset the form
contactForm.reset();
// Log to console for demonstration
console.log('Form submitted:', { name, email, message });
});
}
// Add smooth scrolling for anchor links (if needed in the future)
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
});
// You can add more JavaScript functions here as your website grows
// For example:
// - Image sliders for project galleries
// - Dynamic content loading
// - Interactive animations
// - Form validation
// - etc.