CodeLair website tutorials, articles & scripts

Welcome to CodeLair

We have lots of tutorials on HTML, CSS, JavaScript, PHP and more!

Image Rollovers

Published: 5 April 2005

No doubt you’ve seen this kind of thing. When you hover your mouse over an image, it changes colour, or the image changes completely. With Javascript, you can make images change when you move your mouse over them. This is very useful for image links and the like. This tutorial will show you how.

Continue reading Image Rollovers

PHP Hit Counter

Published: 3 April 2005

This script will allow you to track the number of (non-unique) visitors to your site, or to each page.

The first part shows how to put a very simple hit counter on your pages. When a visitor loads the page, the count (stored in a file) is incremented. You can also choose whether or not to display the hit count on your pages. The second script below is similar to the first, however this one keeps track of the number of hits to each page separately and displays the hit counts in order of popularity.

Continue reading PHP Hit Counter

PHP Includes

Published: 30 March 2005

The ‘include’ function in PHP is probably one of the most useful of all of them. Using this, you can import any document from anywhere into your web page dynamically. If you have dozens of pages with the same navigation, don’t you find it annoying when you want to add a page to the link list? With PHP include you can write one page with the navigation and import it into every page on your site. And when you change this navigation page, the navigation on every page changes too!

Another use of this is to create one page with your design, then use GET parameters in the URL to display the required content. Below we’ll run through a few of the different uses of includes.

Continue reading PHP Includes

Everything Random in JavaScript

Published: 29 October 2004

Ever wanted to display a random quote or image on your pages? Or perhaps you’ve got some links to other sites, and you want to put a random one on a page. This tutorial will explain how to do all these. We’ll utilise the Javascript built-in random functions to display random quotes, images, or a anything you like!

Continue reading Everything Random in JavaScript

Draw Your Own Cartoon Images

Published: 23 October 2004

This tutorial will teach you how to make your own cartoon pictures, sometimes called “grabpics”, using an image editor. Using this method they come out totally clean and high quality.

We use Paint Shop Pro (version 5-7) in this article but the process applies to other image programs such as Photoshop or GIMP. The basic process is to use the line tool to trace over an image/screenshot on a new layer, colour it in, then delete the original image. Let’s get started!

Continue reading Draw Your Own Cartoon Images

Basic CSS tutorial

Published: 22 October 2004

Cascading Style Sheets (CSS) are a valuable tool for adding consistency to your web pages. You can change the look of your whole website quickly and with the minimum of fuss. This tutorial will help you get to know CSS and its capabilities - it explains the basic syntax for CSS, lists the most common CSS rules and explains how to apply them to your pages.

Continue reading Basic CSS tutorial