Random rollover - triggered by link words

This random rollover example is triggered by a mouseover on the link words.
If you want to trigger the rollover by rolling over the image instead of link words, just replace the link words "No Predictions" with the image tag instead.



0 No Predictions





Example of what the code around the image AND link looks like

(P.S. Don't copy this code on the page. Instead, copy it from the source in the body when you have the page open in your HTML editor.)
<body onload="preloadImages();">


<img id="numberimg" src="images/0.gif" width="100" height="100" alt="0">
<a href="#" onmouseover="randomchangeImageif('numberimg'); return true;">No Predictions</a>

Example of what the code in the head looks like

(P.S. Don't copy this code on the page. Instead, copy it from the source in the head when you have the page open in your HTML editor.)

function randInt(low,high) {
	return Math.floor(Math.random()*(high-low+1)+low);
 }

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}


function randomchangeImageif(image) { 
  var Image2Change = document.getElementById(image);
  var n = randInt(1,5);
  var i ="";
  if (n == 1) i = "images/1.gif";
  else if (n == 2) i = "images/2.gif";
  else if (n == 3) i= "images/3.gif";
  else if (n == 4) i= "images/4.gif";
  else if (n == 5) i= "images/5.gif";
  Image2Change.src = i;
}


var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		img1 = newImage("images/1.gif");
		img2 = newImage("images/2.gif");
		img3 = newImage("images/3.gif");
		img4 = newImage("images/4.gif");
		img5 = newImage("images/5.gif");
		preloadFlag = true;
	}
}
The images are preloaded because they might randomly be picked.
Here are the images used: