-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmath2.html
More file actions
41 lines (37 loc) · 1.03 KB
/
math2.html
File metadata and controls
41 lines (37 loc) · 1.03 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
document.write("<h1>컴퓨터 가위,바위, 보 맞추기</h1>");
var game = prompt("가위 바위 보 중에 선택","");
var gameNum;
switch(game){
case "가위":
gameNum = 1;
break;
case "바위":
gameNum = 2;
break;
case "보":
gameNum = 3;
break;
default:
alert("잘못 작성");
location.reload();
}
var com = Math.ceil(Math.random()*3);
document.write("<img src='images/math_img_" + com + ".jpg'>");
if(gameNum == com){
document.write("<img src = 'images/game_1.jpg'>");
}
else{
document.write("<img src = 'images/game_2.jpg'>");
}
</script>
</body>
</html>