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).
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.
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.
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.
What You Said