Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 9th, 2008, 5:37 PM   #1
scottrobot
Newbie
 
Join Date: Mar 2008
Posts: 3
Rep Power: 0 scottrobot is on a distinguished road
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
scottrobot is offline   Reply With Quote
Old Apr 9th, 2008, 5:46 PM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,791
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
Old Apr 9th, 2008, 7:03 PM   #3
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 8 Ooble is on a distinguished road
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.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:57 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC