![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Mar 2008
Posts: 3
Rep Power: 0
![]() |
tic tac toe help
i know javascript is not rly for this type of thing but its for a project
![]() im trying to make a basic tic tac toe game using this type of set up button button button button button button button button button __l____l___ l l ``l````l```` with 9 buttons up top and the actual tic tac toe board below.. could someone explain how i would set up the display like this? i understand the logic of making this work i just cant figure out how to make the display look like this thanks |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,730
Rep Power: 5
![]() |
Re: tic tac toe help
I'd suggest using an HTML table with 3x3 cells. Set one of three possible images inside each cell (E.G. "X.jpg", "O.jpg", "Empty.jpg"). And give each cell's image a unique ID attribute (E.G. "topleft", "topmiddle", "topright", etc...).
Then whenever you need to change the pieces, simply use Javascript to dynamically modify the "src" attribute of the image. For example, if the user sets an "X" in the top-left cell, change the "src" attribute of the element with the ID "topleft" to "X.jpg". |
|
|
|
|
|
#3 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,435
Rep Power: 8
![]() |
Re: tic tac toe help
Why not make the images clickable (use the onclick HTML attribute and set the "pointer" CSS attribute to "cursor")? Also, this is exactly what JavaScript is for.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Another tic tac toe | commodore | Show Off Your Open Source Projects | 12 | Nov 9th, 2007 10:17 AM |