forked from cccnqu/wd106b
-
Notifications
You must be signed in to change notification settings - Fork 0
/
健康網站.html
58 lines (51 loc) · 2.32 KB
/
健康網站.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
<!DOCTYPE html>
<html>
<head>
<meta charset="GB18030">
<title>健康管理網站</title>
</head>
<body>
<h1>BMI計算器</h1>
<p>計算方式:體重(公斤)/身高(公尺)^2
<br>
<br>BMI範圍
<br>體重過輕BMI<18.5
<br>健康體位:8.5<=BMI<24
<br>過重:24<=BMI<27
<br>輕度肥胖:27 <= BMI < 30
<br>中度肥胖:30 <= BMI < 35
<br>重度肥胖:BMI >= 35
<br>
<br>腰圍
<br>男性:>= 90 公分
<br>女性:>= 80 公分
</p>
<br>
<form>
<input id="man" type="radio" checked="checked" name="1" />男
<br>
<input id="woman" type="radio" name="1"/>女
<br>
<p>輸入體重(公斤)<input type = "text" id = "box1" ></p>
<p>輸入身高(公尺)<input type = "text" id = "box2" ></p>
<p><input type = "button" value = "開始計算" onClick = "buttonA()"></p>
<p><input type = "button" value = "重製" onClick = "buttonB()"></p>
<p>您的BMI數值<input name = "text" id = "box3" ></p>
</form>
<script>
function buttonA()
{
x = document.getElementById("box1").value;
y = document.getElementById("box2").value;
z = x / ( y * y );
document.getElementById("box3").value = parseFloat(z);
}
function buttonB()
{
document.getElementById("box1").value = "";
document.getElementById("box2").value = "";
document.getElementById("box3").value = "";
}
</script>
</body>
</html>