-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript3.js
41 lines (37 loc) · 1.01 KB
/
script3.js
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
const X_CLASS = 'x'
const CIRCLE_CLASS = 'circle'
const cellElements = document.querySelectorAll('div.cell')
const board_id = document.querySelectorAll('div.board')
let cell;
var board = "XO-XO-----O-X------O-X------O-X---------------------------X----------------------"
var bigboard = "-X----O--"
for (let i=0; i < board.length; ++i)
{
if (board[i] == "X")
{
cellElements[i].classList.add(X_CLASS)
}
else if (board[i] == "O")
{
cellElements[i].classList.add(CIRCLE_CLASS)
}
}
for (let i=0; i < bigboard.length; ++i)
{
if (bigboard[i] == "X")
{
board_id[i].style.height = "24vh"
board_id[i].style.width = "24vh"
board_id[i].innerHTML = ""
board_id[i].style.backgroundImage = "url('cross1.png')";
}
else if (bigboard[i] == "O")
{
board_id[i].innerHTML = ""
board_id[i].style.backgroundImage = board_id[i].style.backgroundImage = "url('circle1.png')";
board_id[i].style.height = "24vh"
board_id[i].style.width = "24vh"
}
}
board_id[1].style.border = "0px"
board_id[6].style.border = "0px"