Skip to content

Move to Github #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<!-- link to CSS code -->
<link rel="stylesheet" href="tictactoe.css">
<!-- link to JavaScript code -->
<script src="scripts.js"></script>

</head>
<body>
<div class="container">
Expand All @@ -20,12 +20,23 @@ <h1>Welcome to Tic Tac Toe</h1>
<tr>
<!-- the onclick calls a function called "handleClick" and passes itself to it -->
<td id='top-left' onclick="handleClick(this)" ></td>
<td id='top-middle'></td>
<td></td>
<td id='top-middle'onclick="handleClick(this)"></td>
<td id='top-right'onclick="handleClick(this)"></td>
</tr>
<tr>
<td id='middle-left' onclick="handleClick(this)" ></td>
<td id='middle-middle'onclick="handleClick(this)"></td>
<td id='middle-right'onclick="handleClick(this)"></td>
</tr>
<tr>
<td id='bottom-left' onclick="handleClick(this)" ></td>
<td id='bottom-middle'onclick="handleClick(this)"></td>
<td id='bottom-right'onclick="handleClick(this)"></td>
</tr>
<!-- @TODO create new rows and cells for the rest of your TTT board. -->
<!-- @TODO give each new cell an id & an event listener to call the "handleClick" function -->
</table>
</div>
<script src="scripts.js"></script>
</body>
</html>
4 changes: 3 additions & 1 deletion scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const addMarker = (id) => {
// .getElementById(id)
// document
// .innerHTML

document.getElementById(id).innerHTML = currentMarker
changeMarker()
}

Expand Down Expand Up @@ -93,6 +93,8 @@ const resetBoard = () => {
// =
// document
// const

const squares = document.getElementsByTagName("TD")

// loops over the HTML Collection of TDs and clears out the Xs and Os
for (i=0; i < squares.length; i++) {
Expand Down