switches
This commit is contained in:
parent
40fbd8cf96
commit
bb1779187f
14
src/code.js
14
src/code.js
@ -35,7 +35,7 @@ var ids =
|
||||
'20': [2, 0],
|
||||
'21': [2, 1],
|
||||
'22': [2, 2]
|
||||
}
|
||||
};
|
||||
|
||||
var ptm = 1;
|
||||
|
||||
@ -43,13 +43,17 @@ function move(id)
|
||||
{
|
||||
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;
|
||||
|
@ -14,19 +14,19 @@
|
||||
<body onload="load();">
|
||||
<table id='board'>
|
||||
<tr>
|
||||
<th><button onmousedown="move('00');" id='id00'></button></th>
|
||||
<th><button onmousedown="move('01');" id='id01'></button></th>
|
||||
<th><button onmousedown="move('02');" id='id02'></button></th>
|
||||
<th><button onmousedown="move('00');" id='id00'> </button></th>
|
||||
<th><button onmousedown="move('01');" id='id01'> </button></th>
|
||||
<th><button onmousedown="move('02');" id='id02'> </button></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><button onmousedown="move('10');" id='id10'></button></th>
|
||||
<th><button onmousedown="move('11');" id='id11'></button></th>
|
||||
<th><button onmousedown="move('12');" id='id12'></button></th>
|
||||
<th><button onmousedown="move('10');" id='id10'> </button></th>
|
||||
<th><button onmousedown="move('11');" id='id11'> </button></th>
|
||||
<th><button onmousedown="move('12');" id='id12'> </button></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><button onmousedown="move('20');" id='id20'></button></th>
|
||||
<th><button onmousedown="move('21');" id='id21'></button></th>
|
||||
<th><button onmousedown="move('22');" id='id22'></button></th>
|
||||
<th><button onmousedown="move('20');" id='id20'> </button></th>
|
||||
<th><button onmousedown="move('21');" id='id21'> </button></th>
|
||||
<th><button onmousedown="move('22');" id='id22'> </button></th>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user