View Single Post
Old Apr 9th, 2008, 5:46 PM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,788
Rep Power: 5 Sane will become famous soon enough
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".
Sane is online now   Reply With Quote