This commit is contained in:
El Haji Fofana 2022-12-09 10:54:32 +01:00
commit 3c81fab6b5
3 changed files with 74 additions and 44 deletions

View file

@ -2,8 +2,8 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css" type="text/css"> <link rel="stylesheet" href="Puissance4.css" type="text/css">
<link rel="Javascript" href="Page1.js"> <script type="text/javascript" src="Puissance4.js" defer></script>
<html> <html>
<head> <head>
<title>Puissance 4</title> <title>Puissance 4</title>
@ -21,19 +21,64 @@
</header> </header>
<main> <main>
<section> <section>
<article> <table id="Board">
<div id="Puissance4Board"> <tr>
<div class="one">1</div> <td></td>
<div class="two">2</div> <td></td>
<div class="three">3</div> <td></td>
<div class="four">4</div> <td></td>
<div class="five">5</div> <td></td>
<div class="six">6</div> <td></td>
</div> <td></td>
</tr>
</article> <tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</table>
</section> </section>
</main> </main>
<footer>&copy; Copyright 2019 by ME. All Rights Reserved.</footer> <footer>&copy; Copyright 2022 by Sahel Olivan. All Rights Reserved.</footer>
</body> </body>
</html> </html>

View file

@ -1,8 +1,17 @@
var currentRow = 0;
var currentColumn = 0;
const tbody = document.querySelector('#Board'); const tbody = document.querySelector('#Board');
tbody.addEventListener('click', function (e) { tbody.addEventListener('click', function (e){
const cell = e.target.closest('td'); const cell = e.target.closest('td');
if (!cell) {return;} // Quit, not clicked on a cell if (!cell) {return;}
const row = cell.parentElement; const row = cell.parentElement;
console.log(cell.innerHTML, row.rowIndex, cell.cellIndex); currentRow = row.rowIndex;
}); currentColumn = cell.cellIndex;
test();
});
function test(){
console.log(currentRow, currentColumn);
}

View file

@ -62,30 +62,6 @@ footer{
gap: 1em; gap: 1em;
padding: 1em; padding: 1em;
} }
.one{
grid-column: 1;
grid-row: 1;
}
.two{
grid-column: 1;
grid-row: 1;
}
.three{
grid-column: 1;
grid-row: 1;
}
.four{
grid-column: 1;
grid-row: 1;
}
.five{
grid-column: 1;
grid-row: 1;
}
.six{
grid-column: 1;
grid-row: 1;
}
#RegleMorp{ #RegleMorp{
background-color: lightgrey; background-color: lightgrey;
text-align: center; text-align: center;