-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact.html
89 lines (78 loc) · 2.42 KB
/
contact.html
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Contact Us - Minimalist Furniture Co.</title>
<link rel="stylesheet" href="./css/contact.css" />
</head>
<body>
<nav>
<div class="logo">
<h1>Minimalist Furniture Co.</h1>
</div>
<div class="nav-links">
<a href="index.html">Home</a>
<a href="products.html">Products</a>
<a href="about.html">About Us</a>
<a href="contact.html">Contact</a>
<a href="services.html">Services</a>
<a href="testimonials.html">Testimonials</a>
</div>
</nav>
<section class="contact-form">
<h2>Contact Us</h2>
<form id="contact-form">
<label for="name">Your Name</label>
<input
type="text"
id="name"
name="name"
placeholder="Enter your name"
required
/>
<label for="email">Your Email</label>
<input
type="email"
id="email"
name="email"
placeholder="Enter your email"
required
/>
<label for="message">Your Message</label>
<textarea
id="message"
name="message"
placeholder="Enter your message"
rows="5"
required
></textarea>
<button type="submit" class="btn">Send Message</button>
</form>
<div id="form-status"></div>
</section>
<footer>
<p>This website was created for Web Technology module’s Coursework.</p>
<p>© 2024 Minimalist Furniture Co.</p>
</footer>
<script>
const form = document.getElementById("contact-form");
const formStatus = document.getElementById("form-status");
form.addEventListener("submit", function (event) {
event.preventDefault();
const name = form.elements["name"].value;
const email = form.elements["email"].value;
const message = form.elements["message"].value;
if (name === "" || email === "" || message === "") {
formStatus.textContent = "Please fill in all fields.";
formStatus.style.color = "red";
return;
}
formStatus.textContent =
"Thank you for your message, we will get back to you soon!";
formStatus.style.color = "green";
form.reset();
});
</script>
</body>
</html>