Two scripts that can be used to add a little spontaneity to your site are the Random Picture script, which displays an inline graphic randomly chosen from a specified directory of picture graphics, and the Random Page script, which makes a link to a randomly chosen page in a specified directory of pages.
An example of the use of the Random Picture script may be seen on the Lehigh main web page, http://www.lehigh.edu. Each time the user loads that page anew, the picture in the right-hand column changes to a different randomly chosen photograph.
<img
src="/cgi-bin/randompicture.pl?userid&subdirectory"
alt="[caption]" align="bottom" width="??" height="??">
userid is the account where the directory of
images is located and subdirectory is the name of the
directory.
<img
src="/cgi-bin/randompicture.pl?www&icons"
alt="Random Icons" align="bottom">
The random picture script will display a random picture in that image spot every time the page is loaded. If there are only a few pictures, the same picture is more likely to appear repeatedly. If you set width and height tags, all the images will be displayed with those size attributes, and if the graphic is a different size, it will be stretched or shrunk to match that size anyway. Only one caption can be set for these images; you cannot set a different caption/alt tag for different images.
This script, when used in a hypertext link as the URL, will link to a random page in a given directory. When the page on which the link appears is loaded, a page is chosen from the directory specified and the link is pointed to that page. Each time on which the link appears is loaded, a new URL is put in place in the link. (Going to the page linked to, and reloading it, will produce no change.
<A HREF=
"http://www.lehigh.edu/cgi-bin/randompage.pl?userid&directory">
Text of link </A>
userid is the account where the files are stored and
directory is the subdirectory in which the files are
stored.
<A
HREF="http://www.lehigh.edu/cgi-bin/randompage.pl?www&this_server/projects">
Random Project</A>
does this: