-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenchallenge9.html
60 lines (54 loc) · 1.41 KB
/
openchallenge9.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 http-equiv="X-UA-Compatible" content="ie=edge">
<title>10x10</title>
<style>
table {
border : 1px solid blue;
border-collapse : collapse;
}
td {
border : 1px solid blue;
width : 50px;
height : 50px;
padding : 0px;
}
</style>
<script>
var select=0;
var img = new Image();
img.src="pp.png";
function set() {
var table = document.getElementById("demo");
// 10X10 CELL START
for( var i = 0; i < 10; i++ ){
var row = document.createElement("tr");
for( var j = 0; j < 10; j++ ){
var col = document.createElement("td");
col.innerHTML = "<img src=''>"
row.appendChild(col);
}
table.appendChild(row);
}
// 10X10 CELL END
for(var i=0;i<100;i++) {
document.images[i].onclick=moveImage;
document.images[i].style.visibility = "hidden";
}
moveImage();
}
// <img> 태그의 click 리스너
function moveImage() {
document.images[select].src="";
document.images[select].style.visibility = "hidden";
select = Math.floor(Math.random()*100);
document.images[select].src=img.src;
document.images[select].style.visibility = "visible";
}
</script>
</head>
<body onload="set()">
<table id="demo"></table>
</body>
</html>