forked from anuragverma108/WildGuard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Donation.html
203 lines (171 loc) · 6.08 KB
/
Donation.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WildGuard Donations</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.backimg {
background-image: url("assets/images/animals.jpg");
background-repeat: no-repeat;
background-size: cover;
background-position: left;
min-height: 780px;
}
body {
font-family: 'Arial', sans-serif;
background: #f0f8ff;
color: black;
line-height: 1.6;
}
header {
text-align: center;
padding: 20px;
background-color: rgba(255, 253, 253, 0.721);
color: rgb(0, 113, 19);
}
header h1 {
font-size: 3em;
}
header p {
font-size: 1.2em;
}
.donation-form {
background: white;
max-width: 400px;
margin: 30px auto;
padding: 20px;
border-radius: 8px;
box-shadow: 0px 4px 8px rgb(0, 113, 19);
text-align: center;
}
.donation-form h2 {
font-size: 2em;
margin-bottom: 20px;
color: rgb(0, 113, 19);
}
.donation-form p {
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
}
label {
margin-bottom: 5px;
font-weight: bold;
}
input, select {
padding: 10px;
margin-bottom: 15px;
border-radius: 4px;
border: 1px solid #ccc;
font-size: 1em;
transition: border 0.3s ease;
}
input:focus, select:focus {
border-color: rgb(0, 113, 19);
outline: none;
}
/* Styles for the dropdown select */
select {
appearance: none; /* Remove default arrow */
background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="rgb(0, 113, 19)"><path d="M7 10l5 5 5-5z"/></svg>') no-repeat right 10px center; /* Custom arrow */
background-size: 12px;
}
button {
padding: 10px;
background-color: rgb(0, 113, 19);
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background 0.3s ease;
}
button:hover {
background-color: #417788;
}
#thankYouMessage {
text-align: center;
margin-top: 20px;
}
footer {
background-color: rgb(0, 113, 19);
padding: 10px;
text-align: center;
color: white;
position: fixed;
width: 100%;
bottom: 0;
}
</style>
</head>
<body>
<div class="backimg">
<header>
<h1>WildGuard</h1>
<p>Help protect wildlife. Donate today to save the animals!</p>
</header>
<main>
<section class="donation-form">
<h2>Make a Donation</h2>
<p>Your donation will help protect endangered species and wildlife habitats.</p>
<form id="donationForm">
<label for="donorName">Full Name</label>
<input type="text" id="donorName" placeholder="Your Name" required>
<label for="email">Email</label>
<input type="email" id="email" placeholder="Your Email" required>
<label for="amount">Donation Amount</label>
<input type="number" id="amount" placeholder="Enter donation amount Eg.$100" required min="1">
<button type="submit">Donate Now</button>
</form>
<div id="thankYouMessage" style="display:none;">
<h3>Thank you for your generosity!</h3>
<p>Your donation will make a huge difference in protecting animals.</p>
</div>
</section>
</main>
<footer>
<p>© 2024 WildGuard Organization. All rights reserved.</p>
</footer>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
const donationForm = document.getElementById('donationForm');
const amountSelect = document.getElementById('amount');
const customAmountInput = document.getElementById('customAmount');
const thankYouMessage = document.getElementById('thankYouMessage');
// Show custom amount input if 'Custom' is selected
amountSelect.addEventListener('change', function () {
if (amountSelect.value === 'custom') {
customAmountInput.style.display = 'block';
} else {
customAmountInput.style.display = 'none';
}
});
// Handle form submission
donationForm.addEventListener('submit', function (event) {
event.preventDefault();
const name = document.getElementById('donorName').value;
const email = document.getElementById('email').value;
let amount = amountSelect.value === 'custom' ? customAmountInput.value : amountSelect.value;
// Validate custom amount
if (amountSelect.value === 'custom' && (amount <= 0 || amount === "")) {
alert("Please enter a valid custom amount.");
return;
}
if (amount && name && email) {
// Display thank you message
donationForm.style.display = 'none';
thankYouMessage.style.display = 'block';
}
});
});
</script>
</body>
</html>