-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdummy.html
160 lines (137 loc) · 5.15 KB
/
dummy.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Calculate Your BMI</title>
<style>
body
{
background-image: url('dummy.jpg');
background-size: cover;
background-position: center;
/* Add other background styles as needed */
}
{
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
color: #333;
}
.container {
max-width: 400px;
margin: 50px auto;
background-color: rgba(255,255,255);
border-radius: 10px;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}
h1 {
text-align: center;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="number"] {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
margin-bottom: 20px;
}
select {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
margin-bottom: 20px;
}
button {
width: 100%;
padding: 10px;
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
#result {
margin-top: 20px;
}
#fitnessGoal {
text-align: center;
margin-top: 20px;
}
</style>
</head>
<body>
<h1 style="font-size: 70px;">Fitness Tracker</h1> <!-- Display Fitness Tracker as heading -->
<div class="container">
<h2 >Calculate Your BMI</h2> <!-- Update heading to H2 for sub-heading -->
<form id="bmiForm">
<label for="age">Age:</label>
<input type="number" id="age" placeholder="Enter your age">
<label for="gender">Gender:</label>
<select id="gender">
<option value="male">Male</option>
<option value="female">Female</option>
</select>
<label for="height">Height (in meters):</label>
<input type="number" id="height" step="0.01" placeholder="Enter your height" required>
<label for="weight">Weight (in kilograms):</label>
<input type="number" id="weight" step="0.1" placeholder="Enter your weight" required>
<button type="button" onclick="calculateBMI()">Calculate BMI</button>
</form>
<div id="result"></div>
<div id="fitnessGoal">
<button onclick="chooseFitnessGoal()">Click here to choose your fitness goal according to your BMI</button>
</div>
</div>
<script>
function calculateBMI() {
var age = parseInt(document.getElementById('age').value) || 0;
var gender = document.getElementById('gender').value;
var height = parseFloat(document.getElementById('height').value);
var weight = parseFloat(document.getElementById('weight').value);
if (isNaN(height) || isNaN(weight) || height <= 0 || weight <= 0) {
document.getElementById('result').innerHTML = 'Please enter valid height and weight.';
return;
}
// BMI calculation
var bmi = weight / (height * height);
// Display BMI
var resultMsg = 'Your BMI is: ' + bmi.toFixed(2);
// BMI Categories and Suggestions
if (bmi < 18.5) {
resultMsg += ' (Underweight)';
// Example: Suggest to gain weight for underweight individuals
resultMsg += ' - Consider gaining weight.';
} else if (bmi >= 18.5 && bmi < 25) {
resultMsg += ' (Normal weight)';
// Example: Suggest to maintain weight for normal weight individuals
resultMsg += ' - Maintain your weight.';
} else if (bmi >= 25 && bmi < 30) {
resultMsg += ' (Overweight)';
// Example: Suggest to lose weight for overweight individuals
resultMsg += ' - Consider losing weight.';
} else {
resultMsg += ' (Obese)';
// Example: Suggest to lose weight for obese individuals
resultMsg += ' - Consider losing weight.';
}
document.getElementById('result').innerHTML = resultMsg;
}
function chooseFitnessGoal() {
// Redirect to a page where the user can choose their fitness goal based on their BMI
window.location.href = '2ndpage.html';
}
</script>
</body>
</html>