This commit is contained in:
AUnicornWithNoLife 2021-04-11 21:00:58 +01:00
parent 40fbd8cf96
commit bb1779187f
2 changed files with 18 additions and 14 deletions

View File

@ -35,7 +35,7 @@ var ids =
'20': [2, 0], '20': [2, 0],
'21': [2, 1], '21': [2, 1],
'22': [2, 2] '22': [2, 2]
} };
var ptm = 1; var ptm = 1;
@ -43,13 +43,17 @@ function move(id)
{ {
var charater = ""; var charater = "";
if (ptm === 1) if (ptm == 1)
{ {
charater = "X" charater = "X";
ptm = 2;
} }
else (ptm === 2) else
{ {
charater = "O" charater = "O";
ptm = 1;
} }
board[ids[id][0]][ids[id][1]][1].innerHTML = charater; board[ids[id][0]][ids[id][1]][1].innerHTML = charater;

View File

@ -14,19 +14,19 @@
<body onload="load();"> <body onload="load();">
<table id='board'> <table id='board'>
<tr> <tr>
<th><button onmousedown="move('00');" id='id00'></button></th> <th><button onmousedown="move('00');" id='id00'> </button></th>
<th><button onmousedown="move('01');" id='id01'></button></th> <th><button onmousedown="move('01');" id='id01'> </button></th>
<th><button onmousedown="move('02');" id='id02'></button></th> <th><button onmousedown="move('02');" id='id02'> </button></th>
</tr> </tr>
<tr> <tr>
<th><button onmousedown="move('10');" id='id10'></button></th> <th><button onmousedown="move('10');" id='id10'> </button></th>
<th><button onmousedown="move('11');" id='id11'></button></th> <th><button onmousedown="move('11');" id='id11'> </button></th>
<th><button onmousedown="move('12');" id='id12'></button></th> <th><button onmousedown="move('12');" id='id12'> </button></th>
</tr> </tr>
<tr> <tr>
<th><button onmousedown="move('20');" id='id20'></button></th> <th><button onmousedown="move('20');" id='id20'> </button></th>
<th><button onmousedown="move('21');" id='id21'></button></th> <th><button onmousedown="move('21');" id='id21'> </button></th>
<th><button onmousedown="move('22');" id='id22'></button></th> <th><button onmousedown="move('22');" id='id22'> </button></th>
</tr> </tr>
</table> </table>
</body> </body>