re-
VISION

PHOTOGRAPHY AND GRAPHICS BY JAY BOERSMA

WebworkRandom Images on Reload

Reload/refresh the page to randomize the images.
<html>
<head>
<title>Webwork/JavaScript/Random Images on Reload</title>

<script language="javascript">
<!-- // begin
random.m=714025; random.a=4096; random.c=150889;
random.seed = (new Date()).getTime()%random.m;
function random()
{
  random.seed = (random.seed*random.a + random.c) % random.m;
  return random.seed / random.m;
}

function randomizeimages()
{
  randomizeimage('image1', 4, '', '.jpg');
  randomizeimage('image2', 4, '', '.jpg');
  randomizeimage('image3', 4, '', '.jpg');
  randomizeimage('image4', 4, '', '.jpg');
}
function randomizeimage(img, count, base, type)
{
  document.images[img].src = base + Math.round(random() * count) + type;
}
// end hiding -->
</script>

</head>
<body bgcolor="#ffffff" onload="randomizeimages()">

<p align="center">
<img src="1.jpg" height="90" width="120" name="image1">
<img src="1.jpg" height="90" width="120" name="image2">
<img src="1.jpg" height="90" width="120" name="image3">
<img src="1.jpg" height="90" width="120" name="image4">
</p>

</body>
</html>


Javascript Table of Contents | Webwork Table of Contents