Create Your First AJAX Request (Part One)

AJAX is now everywhere on the web. The ability to update content on the web page without reloading the page provides a slicker experience to the user whilst also reducing the load on the server (the server only needs to output the updated content and not the entire page).

Read the rest..

Simple Random Image With PHP

We’ve already covered ‘creating a random image with JavaScript’ but the best way to produce a random image on each page load is to use PHP. Using PHP, you are not relying on the browser supporting JavaScript at all and everyone will see the random images.

OK, to start, we’ll create a function called randomSelect(). This will take two parameters; the directory to scan for images and an array of the allowed file extensions to use.

Read the rest..

Alternate Background Colours

To make it easier for your visitors to visually separate similar elements in your web page (such as table rows, paragraphs, list items etc), you can give alternate elements a different background colour. You can achieve this using a server-side script but here’s a really simple way to do this using JavaScript.

Read the rest..

Form Validation Pop-Ups

If you have required fields in a form, a nice visual clue for the user is to have a message ‘pop up’ if the field hasn’t been filled in. A simple example of what I mean can be seen here.

Read the rest..

Simple Pagination

What is pagination?

Simply put, pagination is splitting up many results in to bite size chunks (pages) that helps the user quickly sort through the results instead of having to scroll way down the page to find what they’re looking for.

Read the rest..

Using CSS Pseudo-Elements

In the 2.1 CSS Specification, there are four different pseudo-elements available to use. These are :after, :before, :first-letter and :first-line. Here’s a quick description of each one.

Read the rest..