-
Notifications
You must be signed in to change notification settings - Fork 0
/
Allergies.html
executable file
·82 lines (76 loc) · 1.44 KB
/
Allergies.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
<!DOCTYPE html>
<html>
<head>
<title>ALLERGIES</title>
<script type="text/javascript">
function check_arg(score)
{
var list="";
do
{
if(score>255)
{
alert("invalid number")
break;
}
if(score>=128)
{
score=score-128;
list=list.concat("cats<br>");
document.getElementById("list").innerHTML=list;
}
else if(score>=64)
{
score=score-64;
list=list.concat("pollen<br>");
document.getElementById("list").innerHTML=list;
}
else if(score>=32)
{
score=score-32;
list=list.concat("chocolate<br>");
document.getElementById("list").innerHTML=list;
}
else if(score>=16)
{
score=score-16;
list=list.concat("tomatoes<br>");
document.getElementById("list").innerHTML=list;
}
else if(score>=8)
{
score=score-8;
list=list.concat("strawberries<br>");
document.getElementById("list").innerHTML=list;
}
else if(score>=4)
{
score=score-4;
list=list.concat("shellfish<br>");
document.getElementById("list").innerHTML=list;
}
else if(score>=2)
{
score=score-2;
list=list.concat("peanuts<br>");
document.getElementById("list").innerHTML=list;
}
else if(score>=1)
{
score=score-1;
list=list.concat("eggs<br>");
document.getElementById("list").innerHTML=list;
}
}
while(score>0);
{
}
}
</script>
</head>
<body>
Enter your Score:<input type="number" id="score"/>
<input type="button" onclick="check_arg(score.value)" value="CHECK"/>
<p id="list"></p>
</body>
</html>