-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhealthTracking.html
244 lines (214 loc) · 9.44 KB
/
healthTracking.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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Health Tracking</title>
<style>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
canvas {
position: absolute;
top: 0;
left: 0;
z-index: -1;
}
header {
background-color: #333;
color: #fff;
text-align: center;
padding: 10px 0;
}
nav {
display: flex;
justify-content: center;
}
nav a {
color: #fff;
text-decoration: none;
margin: 0 20px;
font-weight: bold;
}
.content {
text-align: center;
padding: 50px;
}
.research-content {
padding: 50px;
text-align: left;
}
</style>
<style>
@import url('https://fonts.googleapis.com/css?family=Patrick+Hand&display=swap');
.button-container {
text-align: center;
}
.cartoon-button {
font-family: 'Patrick Hand', cursive;
border: 2px solid #000;
padding: 15px 30px;
background-color: #fff;
text-decoration: none;
display: inline-block;
margin: 10px;
border-radius: 5px;
cursor: pointer;
text-align: center;
font-size: 24px;
}
.cartoon-button:hover {
background-color: #f2f2f2;
}
</style>
<style>
video {
position: fixed;
top: 0;
left: 0;
min-width: 100%;
min-height: 100%;
z-index: -1;
}
.content {
position: relative;
z-index: 1;
text-align: center;
padding: 50px;
}
h1 {
color: #fff;
font-size: 36px;
}
p {
color: #fff;
font-size: 18px;
}
</style>
</head>
<body>
<video autoplay loop muted>
<source src="background.mp4" type="video/mp4">
</video>
<header>
<nav>
<a href="HOME.html">HOME</a>
<a href="data.html">PERSONAL DATA</a>
<a href="about.html">ABOUT US</a>
<a href="ability.html">ABILITY DIMENSION</a>
<a href="explore.html">EXPLORE</a>
</nav>
</header>
<main>
<div class="button-container">
<a href="healthRecord.html" class="cartoon-button">Health Record</a>
<a href="healthTracking.html" class="cartoon-button">Health Tracking</a>
<a href="healthAdvisor.html" class="cartoon-button">Health Advisor</a>
</div>
</main>
<body>
<center>
<p onLoad="printData();"> </p>
<h1 id="BMIData"> </h1>
<p id="BMIText"> </p>
<p> </p>
<p> </p>
<!-- h2 is black, may be change to white -->
<h1 id="HRData"> </h1>
<p id="HRText"> </p>
<p id="HRText2"> </p>
</body>
<script>
function calculateBMI(){
var heightInMeter = localStorage.getItem("height")/100.0;
localStorage.setItem("BMI",localStorage.getItem("weight")/Math.pow(2,heightInMeter));
return localStorage.getItem("BMI");
}
function zeroToTwo(){
document.getElementById("HRText").innerHTML = ('Typical heart rate is around 100 to 160 beats per minute');
if(localStorage.getItem("heartRate") < 100){
document.getElementById("HRText2").innerHTML = ('Lower than 100 beats per minute may be considered as bradycardia');
}else if(localStorage.getItem("heartRate") > 160){
document.getElementById("HRText2").innerHTML = ('Higher than 160 beats per minute may be considered as tachycardia');
}
}
function three2Five(){
document.getElementById("HRText").innerHTML = ('Typical heart rate is around 80 to 120 beats per minute');
if(localStorage.getItem("heartRate") < 80){
document.getElementById("HRText2").innerHTML = ('Lower than 80 beats per minute may be considered as bradycardia');
}else if(localStorage.getItem("heartRate") > 120){
document.getElementById("HRText2").innerHTML = ('Higher than 120 beats per minute may be considered as tachycardia');
}
}
function six2Twelve(){
document.getElementById("HRText").innerHTML = ('Typical heart rate is around 70 to 100 beats per minute');
if(localStorage.getItem("heartRate") < 70){
document.getElementById("HRText2").innerHTML = ('Lower than 70 beats per minute may be considered as bradycardia');
}else if(localStorage.getItem("heartRate") > 100){
document.getElementById("HRText2").innerHTML = ('Higher than 100 beats per minute may be considered as tachycardia');
}
}
function thirteen2Twenty(){
document.getElementById("HRText").innerHTML = ('Typical heart rate is around 60 to 100 beats per minute');
if(localStorage.getItem("heartRate") < 70){
document.getElementById("HRText2").innerHTML = ('Lower than 60 beats per minute may be considered as bradycardia');
}else if(localStorage.getItem("heartRate") > 100){
document.getElementById("HRText2").innerHTML = ('Higher than 100 beats per minute may be considered as tachycardia');
}
}
function between18and65(){
document.getElementById("HRText").innerHTML = ('Typical heart rate is around 60 to 100 beats per minute');
if(localStorage.getItem("heartRate") < 60){
document.getElementById("HRText2").innerHTML = ('Lower than 60 beats per minute may be considered as bradycardia');
}else if(localStorage.getItem("heartRate") > 100){
document.getElementById("HRText2").innerHTML = ('Higher than 100 beats per minute may be considered as tachycardia');
}
}
function older(){
document.getElementById("HRText").innerHTML = ('Typical heart rate is around 60 to 100 beats per minute');
if(localStorage.getItem("heartRate") < 60){
document.getElementById("HRText2").innerHTML = ('Lower than 60 beats per minute may be considered as bradycardia');
}else if(localStorage.getItem("heartRate") > 100){
document.getElementById("HRText2").innerHTML = ('Higher than 100 beats per minute may be considered as tachycardia');
}
}
function printData(){
var BMI = calculateBMI();
if(BMI < 18.5){
document.getElementById("BMIData").innerHTML = ('Your BMI is '+ (Math.round(localStorage.getItem("BMI")*100)/100).toFixed(2));
document.getElementById("BMIText").innerHTML = ('You are underweight.');
}else if (BMI < 24.9){
document.getElementById("BMIData").innerHTML = ('Your BMI is '+ (Math.round(localStorage.getItem("BMI")*100)/100).toFixed(2));
document.getElementById("BMIText").innerHTML = ('You are normal weight.');
}else if (BMI < 29.9){
document.getElementById("BMIData").innerHTML = ('Your BMI is '+ (Math.round(localStorage.getItem("BMI")*100)/100).toFixed(2));
document.getElementById("BMIText").innerHTML = ('You are overweight.');
}else{
document.getElementById("BMIData").innerHTML = ('Your BMI is '+ (Math.round(localStorage.getItem("BMI")*100)/100).toFixed(2));
document.getElementById("BMIText").innerHTML = ('You are obese.');
}
if(localStorage.getItem("age")< 3) {
document.getElementById("HRData").innerHTML = ('You heart rate is ' + localStorage.getItem("heartRate")+ 'beats per minute');
zeroToTwo();
}else if(localStorage.getItem("age")< 6){
document.getElementById("HRData").innerHTML = ('You heart rate is ' + localStorage.getItem("heartRate")+ 'beats per minute');
three2Five();
}else if(localStorage.getItem("age")< 13){
document.getElementById("HRData").innerHTML = ('You heart rate is ' + localStorage.getItem("heartRate")+ 'beats per minute');
six2Twelve();
}else if(localStorage.getItem("age")< 20){
document.getElementById("HRData").innerHTML = ('You heart rate is ' + localStorage.getItem("heartRate")+ 'beats per minute');
thirteen2Twenty();
}else if(localStorage.getItem("age")< 66){
document.getElementById("HRData").innerHTML = ('You heart rate is ' + localStorage.getItem("heartRate")+ 'beats per minute');
between18and65();
}else{
document.getElementById("HRData").innerHTML = ('You heart rate is ' + localStorage.getItem("heartRate")+ 'beats per minute');
older();
}
}
printData();
</script>
</body>
</html>