now correctly stores ellements

This commit is contained in:
AUnicornWithNoLife 2021-04-11 20:56:32 +01:00
parent 1cc661be2d
commit 341ee0eb54
2 changed files with 24 additions and 19 deletions

View File

@ -1,21 +1,26 @@
var board =
[
var board;
function load()
{
board =
[
[0, document.getElementById("id00")],
[0, document.getElementById("id01")],
[0, document.getElementById("id02")]
],
[
[0, document.getElementById("id10")],
[0, document.getElementById("id11")],
[0, document.getElementById("id12")]
],
[
[0, document.getElementById("id20")],
[0, document.getElementById("id21")],
[0, document.getElementById("id22")]
]
];
[
[0, document.getElementById("id00")],
[0, document.getElementById("id01")],
[0, document.getElementById("id02")]
],
[
[0, document.getElementById("id10")],
[0, document.getElementById("id11")],
[0, document.getElementById("id12")]
],
[
[0, document.getElementById("id20")],
[0, document.getElementById("id21")],
[0, document.getElementById("id22")]
]
];
}
var ids =
{
@ -49,5 +54,5 @@ function move(id)
charater = "O"
}
board[ids[id] [0]] [ids[id] [1]] [1].innerHTML = charater;
board[ids[id][0]][ids[id][1]][1].innerHTML = charater;
}

View File

@ -11,7 +11,7 @@
<title>Tic Tac Toe</title>
</head>
<body>
<body onload="load();">
<table id='board'>
<tr>
<th><button onmousedown="move('00');" id='id00'></button></th>