Javascript: Browser Based Tic Tac Toe Game
posted February 20, 2008 - 11:16pmDid you know that you can create online games with Javascript?
You'll likely want to add in some PHP and AJAX for real power, but you can create quite a nifty front-end interface for your game using Javascript.
Using DOM to Manipulate HTML
The major concept you'll need to wrap your mind around is using the DOM to manipulate HTML. Every element on a page - including the text you're reading - has an "object" representation.
Using some well-thought-out Javascript and HTML, we can easily manipulate every piece of a web page through Javascript. You can move blocks around, change, sizes, change background images, handle user input, and much more.
If you're unfamiliar with DOM and Javascript, you may want to head over to this article about resources for learning DOM.
Creating a Game Board - Tic Tac Toe
If you do know a little about JS and DOM - or if you're just brave enough to jump right in - here are two good articles on creating a game interface with JS and DOM.
The first article walks through the concept of a Javascript based game online game. It discusses a bit of the theory - where JS, PHP, AJAX, and DOM fit into the equation. It also provides some code snippets to get you started with developing a game interface.
The second article has more practical results. By the end of that article, you'll have a 100% functioning Javascript-based Tic-Tac-Toe board.
What are you waiting for? Get to learning. Start creating.

Comments
Post new comment