1. Tech

Your suggestion is on its way!

An email with a link to:


was emailed to:

Thanks for sharing About.com with others!

Noughts and Crosses

Part 1 : Sample and HTML

More of this Feature

JavaScript and Stylesheet

Another simple game that can be easily added to any web site. Almost everyone played noughts and crosses as a child (or tic-tac-toe as the Americans call it for some unexplainable reason). Well now your web page can beat (or at least draw) with all comers when you add this completely unobtrusive JavaScript to your page. First let's start with a working example to show you what it looks like. We'll use buttons for the nine squares to give it a nice neat appearance.

So now you've been beaten several times (or at best achieved a draw) the next step is to add the script to your page. Let's start by adding the HTML. You need this in the head of your page:

<link rel="stylesheet" type="text/css" href="ox.css">

One tag in the body where you want the game to appear:

<div id="ox"></div>

and one tag at the bottom just before the <body> tag.

<script type="text/javascript src="ox.js"></script>

Now all that remains is to create the ox.js and ox.css files.

See More About

©2017 About.com. All rights reserved.