-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTic Tack Toe.html
57 lines (50 loc) · 1.65 KB
/
Tic Tack Toe.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
<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.9.1.min.js"></script>
</head>
<body>
<table border="0">
<tr>
<th><button type="button" id="button1" onclick="changeButton(1)"><img id="pic1" src="blank.bmp" alt="Error"></button></th>
<th><button type="button" id="button2" onclick="changeButton(2)"><img id="pic2" src="blank.bmp" alt="Error"></button></th>
<th><button type="button" id="button3" onclick="changeButton(3)"><img id="pic3" src="blank.bmp" alt="Error"></button></th>
</tr>
<tr>
<th><button type="button" id="button4" onclick="changeButton(4)"><img id="pic4" src="blank.bmp" alt="Error"></button></th>
<th><button type="button" id="button5" onclick="changeButton(5)"><img id="pic5" src="blank.bmp" alt="Error"></button></th>
<th><button type="button" id="button6" onclick="changeButton(6)"><img id="pic6" src="blank.bmp" alt="Error"></button></th>
</tr>
<tr>
<th><button type="button" id="button7" onclick="changeButton(7)"><img id="pic7" src="blank.bmp" alt="Error"></button></th>
<th><button type="button" id="button8" onclick="changeButton(8)"><img id="pic8" src="blank.bmp" alt="Error"></button></th>
<th><button type="button" id="button9" onclick="changeButton(9)"><img id="pic9" src="blank.bmp" alt="Error"></button></th>
</tr>
</table>
<script>
var isX=true;
var square = newArray();
for(var i=0;i<9;i++){
square[i]=0;
}
alert(square[1]);
function changeButton(a){
if(square[a]=0){
if(isX){
$("#pic"+a).attr("src","x.bmp");
isX=false;
square[a]=1;
}
else{
$("#pic"+a).attr("src","o.bmp");
isX=true;
square[a]=2;
}
checkWin();
}
}
function checkWin(){
}
</script>
</body>
</html>