-
Notifications
You must be signed in to change notification settings - Fork 307
/
bmi.html
42 lines (38 loc) · 951 Bytes
/
bmi.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
<!DOCTYPE html><html lang="ja"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width"><link rel="icon" href="data:">
<title>BMI計算</title>
<style>
body {
background-color: hsl(50, 100%, 80%);
font-family: sans-serif;
}
* {
margin: 1em;
}
textarea {
width: 20em;
height: 5em;
}
</style>
</head>
<body>
身長<input type="text" id="height">cm<br>
体重<input type="text" id="weight">kg<br>
<button id="btn">BMI</button><br>
<textarea id="output"></textarea><br>
<script type="module">
import { print } from "https://js.sabae.cc/";
btn.onclick = () => {
const bmi = weight.value / (height.value / 100) ** 2;
let s = "";
if (bmi < 18.5) {
s = "やせ型";
} else if (bmi < 25) {
s = "標準";
} else {
s = "肥満";
}
output.value = `${s}です BMI ${bmi}`;
};
</script>
</body>
</html>