Random images are very easy to add to the template pages.
First, give the image you want random a unique ID attribute (I'm going to use randimg1).
- Code: Select all
<img id="randimg1" src="" alt="Random campus image" />
Next, create a javascript file for the random images (You can use the leftRandomPromo.js or rightRandomPromo.js files in the sharedcode directory as a template for this file). Follow the directions within the template javascript files for what to put in each array, then save this file within your sharedcode directory.
Here's an example file I called randimg1.js
- Code: Select all
/*
Feel free to change these and add your own images.
Each image has up to 4 attributes associated with it:
[0] = URL of the image source (.jpg .gif) *
[1] = ALT text description of the image *
[2] = URL to take the client to when the image is clicked (optional)
[3] = javascript onclick events (optional)
The images will rotate after the number of seconds given to the rotateImg
function (0 for no rotate).
*/
var imgArray1 = new Array;
imgArray1[0] = new Array;
imgArray1[0][0] = "http://www.unl.edu/unlpub/2004sharedgraphics/splash_strollhaymarket.jpg";
imgArray1[0][1] = "Strolling in the Haymarkey District";
imgArray1[0][2] = "";
imgArray1[0][3] = "";
imgArray1[1] = new Array;
imgArray1[1][0] = "http://www.unl.edu/unlpub/2004sharedgraphics/splash_cathergarden.jpg";
imgArray1[1][1] = "Cather Garden, City Campus";
imgArray1[1][2] = "";
imgArray1[1][3] = "";
imgArray1[2] = new Array;
imgArray1[2][0] = "http://www.unl.edu/unlpub/2004sharedgraphics/splash_michaeljames.jpg";
imgArray1[2][1] = "Michael James, Professor & Quiltmaker";
imgArray1[2][2] = "";
imgArray1[2][3] = "";
rotateImg("imgArray1","randimg1",0);
Take care to change the last line of the javascript file to reference the correct array (imgArray1) and the correct image ID (randimg1).
Then simply add a reference to this javascript file on your page AFTER the image.
- Code: Select all
<script type="text/javascript" src="randimg1.js"></script>
Good luck.