-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcontact.html
159 lines (158 loc) · 5.13 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html lang="en">
<head>
<script
type="text/javascript"
src="https://cdn.jsdelivr.net/npm/@emailjs/browser@3/dist/email.min.js"
></script>
<script type="text/javascript">
(function () {
// https://dashboard.emailjs.com/admin/account
emailjs.init("t4-f_BUwzCvI8Ec1b");
})();
</script>
<script type="text/javascript">
window.onload = function () {
document
.getElementById("contact-form")
.addEventListener("submit", function (event) {
event.preventDefault();
if (!validateMyForm()) {
return;
}
// generate a five digit number for the contact_number variable
this.contact_number.value = (Math.random() * 100000) | 0;
inputs = document.querySelectorAll("#contact-form #text-input");
for (let i = 0; i < inputs.length; i++) {
inputs[i].value = "";
}
// these IDs from the previous steps
emailjs.sendForm("service_3ng6uyb", "template_p1aj9go", this).then(
function () {
console.log("SUCCESS!");
},
function (error) {
console.log("FAILED...", error);
}
);
});
};
function validateMyForm() {
inputs = document.querySelectorAll("#contact-form #text-input");
for (let i = 0; i < inputs.length; i++) {
if (inputs[i].value === "") {
return false;
}
}
return true;
}
</script>
</head>
<meta charset="UTF-8" />
<title>Contact</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="contact.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Josefin+Slab&display=swap"
rel="stylesheet"
/>
<body>
<nav class="main-nav-bar">
<div>
<a class="main-page-links" href="menu.html">menu</a>
</div>
<div>
<a class="main-page-links" href="about.html">about</a>
</div>
<div>
<a class="main-page-links" id="selected-nav-bar" href="contact.html"
>contact us</a
>
</div>
<div>
<a class="main-page-links" href="order.html">order</a>
</div>
<div id="socials">
<a
href="https://www.instagram.com/uw_ohbearcafe/?hl=en"
target="_blank"
>
<i class="fa fa-instagram" aria-hidden="true"></i>
</a>
<a href="https://www.facebook.com/ohbearcafe/" target="_blank">
<i class="fa fa-facebook-square" aria-hidden="true"></i>
</a>
<a href="mailto:LNHCAFE88@gmail.com">
<i class="fa fa-envelope-o" aria-hidden="true"></i>
</a>
</div>
<div id="oh-bear-logo">
<a href="index.html"
><img src="img/ohBearLogo.png" alt="The Oh Bear Cafe Logo"
/></a>
</div>
</nav>
<form id="contact-form">
<h2>Contact Us!</h2>
<input type="hidden" name="contact_number" />
<label for="name">Full Name <br /></label>
<input type="text" name="user_name" id="text-input" />
<br />
<label for="email">Email <br /></label>
<input type="text" name="user_email" id="text-input" />
<br />
<label for="name">Message <br /></label>
<textarea name="message" id="text-input"></textarea>
<br />
<input type="submit" value="Send" id="send-form" />
<br />
</form>
<nav class="main-nav-bar" id="bottom-nav-bar">
<div id="oh-bear-logo-bottom">
<a href="index.html"
><img src="img/ohBearLogo.png" alt="The Oh Bear Cafe Logo"
/></a>
<p>
cafe
<br />
& teahouse
</p>
</div>
<div>
<a class="main-page-links" href="menu.html">menu</a>
</div>
<div>
<a class="main-page-links" href="about.html">about</a>
</div>
<div>
<a class="main-page-links" id="selected-nav-bar" href="contact.html"
>contact us</a
>
</div>
<div>
<a class="main-page-links" href="order.html">order</a>
</div>
<div id="socials">
<a
href="https://www.instagram.com/uw_ohbearcafe/?hl=en"
target="_blank"
>
<i class="fa fa-instagram" aria-hidden="true"></i>
</a>
<a href="https://www.facebook.com/ohbearcafe/" target="_blank">
<i class="fa fa-facebook-square" aria-hidden="true"></i>
</a>
<a href="contact.html" target="_blank">
<i class="fa fa-envelope-o" aria-hidden="true"></i>
</a>
</div>
</nav>
</body>
</html>