-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiletim.html
158 lines (147 loc) · 3.63 KB
/
iletim.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>İletişim Sayfası</title>
<style>
body {
font-family: Arial, sans-serif;
background: linear-gradient(135deg, #6a11cb, #2575fc);
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
color: white;
}
h2 {
font-weight: 400;
}
.contact-form {
background: white;
color: #333;
padding: 2rem;
border-radius: 8px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
width: 100%;
max-width: 400px;
}
.contact-form h2 {
text-align: center;
margin-bottom: 1rem;
color: #6a11cb;
}
label {
display: block;
margin-bottom: 0.5rem;
font-weight: bold;
}
input, textarea {
box-sizing: border-box;
width: 100%;
padding: 0.8rem;
border: 1px solid #ddd;
border-radius: 5px;
outline: none;
transition: all 0.3s ease;
margin-bottom: 1.5rem;
}
input:focus, textarea:focus {
border-color: #6a11cb;
box-shadow: 0 0 5px rgba(106, 17, 203, 0.5);
}
button {
border: unset;
--color: #6a11cb;
width: 100%;
padding: 0.8rem;
background-color: white;
border-color:var(--color);
border-radius:5px;
border-style: solid;
color: var(--color);
font-size: 1.2rem;
cursor: pointer;
transition: border-color 0.3s ease, color 0.3s ease, border-radius 0.3s ease;
}
button:hover {
--color: #2575fc;
}
button:active {
border-radius: 1em;
}
.feedback {
text-align: center;
margin-top: 1rem;
opacity: 0;
transform: translateY(-20px);
transition: all 0.5s ease;
}
.feedback.success {
color: #28a745;
}
.feedback.error {
color: #dc3545;
}
.feedback.show {
opacity: 1;
transform: translateY(0);
}
</style>
</head>
<body>
<div class="contact-form">
<h2>Bizimle İletişime Geçin</h2>
<label for="email">E-Posta</label>
<input type="email" id="email" name="email" required>
<label for="message">İleti</label>
<textarea id="message" name="message" rows="4" required></textarea>
<button type="submit">Gönder</button>
<div class="feedback" id="feedback"></div>
</div>
<script>
const emailinput = document.getElementById('email');
const messageinput = document.getElementById('message');
const submitter = document.querySelector("[type=submit]");
const feedback = document.getElementById('feedback');
const KEY = 'af46f188-faab-4bc9-a591-bb19c3d2656e'; // Replace with your actual access key.
submitter.addEventListener('click', async (event) => {
event.preventDefault();
const formData = {
access_key: KEY,
email: emailinput.value,
message: messageinput.value,
};
feedback.textContent = 'Gönderiliyor...';
feedback.className = 'feedback show';
try {
if (!(emailinput.value && messageinput.value)) {
throw new Error("Gerekli tüm alanları doldurunuz");
}
const response = await fetch('https://api.web3forms.com/submit', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify(formData),
});
if (response.ok) {
feedback.textContent = 'Teşekkürler! İletiniz ulaştırıldı.';
feedback.className = 'feedback success show';
emailinput.value = "";
messageinput.value = "";
} else {
throw new Error('İleti gönderilemedi. Lütfen daha sonra tekrar deneyin');
}
} catch (error) {
feedback.textContent = error.message;
console.log(error);
feedback.className = 'feedback error show';
}
setTimeout(() => feedback.classList.remove('show'), 4000);
});
</script>
</body>
</html>