-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.html
More file actions
89 lines (78 loc) · 3.12 KB
/
contact.html
File metadata and controls
89 lines (78 loc) · 3.12 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
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>
<link rel="stylesheet" type="text/css" href="css/contact.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Online Store</title>
</head>
<body>
<div class="navbar">
<div class="navbar-left">
<a href="/">eDeliverX</a>
</div>
<div class="navbar-right">
<a href="products.html">Products</a>
<a href="cart.html">Cart</a>
<a href="account.html">Sign in</a>
</div>
</div>
<div class="container">
<h2>Contact Me</h2>
<form id="contact-form" action="#" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="text" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
<input type="submit" value="Submit">
</form>
</form>
<div id="message-container"></div>
</div>
</div>
<footer class="footer">
<div class="contact-info">
<h2>Contact Us</h2>
<p><strong>Email:</strong> info@edeliverx.com</p>
<p><strong>Phone:</strong> +1 123-456-7890</p>
<p><a href="contact.html">Go to Contact Us page</a></p>
</div>
<div class="social-media-icons">
<a href="#"><img src="images/insta.png" alt="Instagram" style="width: 30px; height: 30px;"></a>
<a href="#"><img src="images/face.png" alt="Facebook" style="width: 30px; height: 30px;"></a>
<a href="#"><img src="images/twit.png" alt="Twitter" style="width: 30px; height: 30px;"></a>
</div>
</footer>
<script>
var form = document.getElementById('contact-form');
var messageStatus = document.getElementById('message-status');
form.addEventListener('submit', function(event) {
event.preventDefault();
// Get the form field values
var name = document.getElementById('name').value;
var email = document.getElementById('email').value;
var message = document.getElementById('message').value;
// Perform form validation
if (name.trim() === '' || email.trim() === '' || message.trim() === '') {
messageStatus.textContent = 'Please fill in all the required fields.';
return;
}
// Validate email format
if (!isValidEmail(email)) {
messageStatus.textContent = 'Please enter a valid email address.';
return;
}
// Display the success message
messageStatus.textContent = 'Your message has been sent.';
form.reset();
});
// Function to validate email format
function isValidEmail(email) {
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return emailRegex.test(email);
}
</script>
</body>
</html>