forked from cccnqu/wd106b
-
Notifications
You must be signed in to change notification settings - Fork 0
/
110610509.html
65 lines (64 loc) · 2.83 KB
/
110610509.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>BMI計算</title>
<style>
body
{background-color:#FFFFCC;}
h1 {color:#FF0000;}
table
{border:1px groove green;}
th
{
background-color:green;
color:white;
}
</style>
</head>
<body>
<h1><center>BIM計算器 </center></h1>
<h3><center>參考數值</center></h3>
<center><table border="10">
<tr>
<th></th>
<th>BMI值(kg/m2)</th>
</tr>
<tr>
<th>體重過輕</th>
<td><center>BMI < 18.5</center></td>
</tr>
<tr>
<th>正常範圍</th>
<td><center>18.5≦BMI<24</center></td>
</tr>
<tr>
<th>異常範圍</th>
<td>過重:24≦BMI<27<br>
輕度肥胖:27≦BMI<30<br>
中度肥胖:30≦BMI<35<br>
重度肥胖:BMI≧35<br>
</td>
</tr>
</table></center><center>
身高(m): <input type="text" id="box1" value=""><br>
體重(kg): <input type="text" id="box2" value=""><br>
<input type="button" value="重置" onClick="reset()">
<input type="button" value="計算" onClick="equal()"><br>
您的BMI值為:<input type="text" name="height" id="box3" value="">
</center>
<script>
function equal(){
x = document.getElementById("box1").value;
y = document.getElementById("box2").value;
z = y/(x*x);
document.getElementById("box3").value = parseFloat(z.toFixed(2));
}
function reset(){
document.getElementById("box1").value="";
document.getElementById("box2").value="";
document.getElementById("box3").value="";
}
</script>
</body>
</html>