Background information

Scripting conventions

Some useful scripts:

User Alerts

Page information

Pull-down menus

Random images

Mouseovers

Windows and remotes

Where to go from here



Classes home

HTML Info home

 

Javascript

Jeff Williamson
Northern Virginia Community College
www.nvcc.edu/home/nvwillj/html-graphics/
nvwillj@nvcc.edu


Random images

Random images are a good way to illustrate more than one view of something within limited screen space. Institutions, for example, might want to have different images load to show different aspects of the institution - research, production, marketing, and so forth. Images of people seem particularly suited for rotation, to ensure that all groups are represented.

Examples:

The front page for the NVCC-AL campus - the main image of a student rotates among four different student pictures

The birth announcement for my son uses this refresh tag in the <HEAD>

<META HTTP-EQUIV="Refresh" CONTENT="2; URL=your_file.html">

and reloads the page with a new random image - there are about 20 possible images referenced in the script.

Script

I found this script a while back and have used it because it pretty much gets the job done (though it seems to get stuck on an image now and then). One tweak I have found necessary for small numbers of images is to see how things reload and then to use extra copies of images that don't seem to appear often enough, e.g.

Required:

RandomImage("left_graphic1.gif left_graphic2.gif left_graphic3.gif ");

Recommended:

RandomImage("left_graphic1.gif left_graphic2.gif left_graphic3.gif left_graphic2.gif left_graphic1.gif ");

No particular sequence or order is implied; just add extra instances of whatever images seem reluctant to show until you like the results.

Note

The script seems too long; I'm sure there's a better way to get this done. If your server is ASP capable, I've read over a more powerful and shorter solution done in ASP. You can even specify what percent of the time you want various images displayed. No guarantees until I work it out myself first, though.

 

Comments? Questions? Visit the help page

Machine translations of this page into
Spanish, French, German, Italian, and Portugese
are available

Last updated information on updates page