-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
122 lines (101 loc) · 4.04 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<style>
body, html {
overflow: hidden;
margin: 0;
padding: 0;
height: 100%;
}
.container {
width: 100%;
height: 100%;
position: relative;
}
img {
width: 100%;
height: 100%;
position: absolute;
object-fit: cover;
}
.form-container {
position: absolute;
width: 50%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
margin-top: 20px;
}
input[type="text"], button {
padding: 1%;
font-size: 1.5vw;
margin-bottom: 1%;
width: 100%;
}
button {
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
button:hover {
opacity: 0.7;
}
</style>
</head>
<body>
<div style="width: 100vw; height: 1vh; left: -1.5%; top: 25%; position: absolute; display: flex; justify-content: center; align-items: center; font-size: 5vw; text-align: center; color: white; text-shadow: 0.2vw -0.1vw 0.25vw #006400, 0.2vw -0.1vw 0.25vw #006400; font-family: 'Bradley Hand', cursive; z-index: 2;">
Fauna Forest --- Login
</div>
<div class="container">
<img src="static/backgroundcolorgreen.png" alt="Background Color Green" />
</div>
<img id="BackgroundImage" style="width: 100%; height: 100%; left: 0%; top: 0%; opacity: 50%; position: absolute" src="static/bgexample3.png" alt="Background Image" />
<script>
function changeFontColor(inputId) {
document.getElementById(inputId).style.color = 'black';
}
function validateForm() {
var input1 = document.getElementById("input1").value;
var input2 = document.getElementById("input2").value;
var input3 = document.getElementById("input3").value;
if (input1.trim() === '' || input2.trim() === '' || input3.trim() === '') {
alert("Please fill in all three fields.");
return false;
}
// save current user's info to local storage
addUser(input1, input2, input3);
// Redirect to instructions.html on successful validation
window.location.href = 'instructions.html';
return false; // Prevent form submission
}
/**
* Add new users to locally stored JSON object
**/
function addUser(firstName, lastInitial, ageRange) {
localStorage.setItem('fname', JSON.stringify(firstName));
localStorage.setItem('linitial', JSON.stringify(lastInitial));
localStorage.setItem('agerange', JSON.stringify(ageRange));
}
</script>
<div class="form-container">
<form id="stringForm" onsubmit="return validateForm()" method="post">
<input type="text" id="input1" name="input1" placeholder="Enter your first name" required
oninput="changeFontColor('input1')" style="width: 45vw; height: 5vh; font-size: 25px; color: gray; border: 0.2vw solid #006400;"><br>
<input type="text" id="input2" name="input2" placeholder="Enter your last initial" required
oninput="changeFontColor('input2')" style="width: 45vw; height: 5vh; font-size: 25px; color: gray; border: 0.2vw solid #006400;"><br>
<select id="input3" name="input3" required onchange="changeFontColor('input3')"
style="width: 46vw; height: 5vh; margin-bottom: 10px; font-size: 20px; color: gray; left: 10%; border: 0.2vw solid #006400;">
<option value="" style="font-size: 22px; color: gray;" disabled selected>Select Age Range</option>
<option value="1" style="font-size: 22px; color: gray;">Less than 8</option>
<option value="2" style="font-size: 22px; color: gray;">8 to 10</option>
<option value="3" style="font-size: 22px; color: gray;">11 to 13</option>
<option value="4" style="font-size: 22px; color: gray;">14 to 16</option>
<option value="5" style="font-size: 22px; color: gray;">17+</option>
</select>
<button type="submit" style="width:46vw; height: 8vh; margin-top: 1vw; font-family: Bradley Hand; font-size: 2.7vw; border: 0.2vw solid #006400;">Login</button>
</form>
</div>
</body>
</html>