Webwork
/
Refrigerator Poetry

Another JavaScript randomization example, this one randomizes six separate image groups—article, adjective, subject, verb, object, adverb—each of which has six separate word options.

To randomize the images click here.

Source:
<script language="javascript">
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', 6, 'article/', '.png');
randomizeimage('image2', 6, 'adjective/', '.png');
randomizeimage('image3', 6, 'subject/', '.png');
randomizeimage('image4', 6, 'verb/', '.png');
randomizeimage('image5', 6, 'object/', '.png');
randomizeimage('image6', 6, 'adverb/', '.png');
}

function randomizeimage(img, count, base, type)
{
document.images[img].src = base + Math.floor(random() * count + 1) + type
}
</script>

<div style="margin: 0 auto; width: 500px; text-align: center; padding: 20px; background: #ccc">
<img name="image1" src="article/7.png">
<img name="image2" src="adjective/5.png">
<img name="image3" src="subject/6.png">
<img name="image4" src="verb/5.png">
<img name="image5" src="object/6.png">
<img name="image6" src="adverb/5.png"></div>

The file list for the word groups looks like this:

file-list
Previous | Webwork Table of Contents | Next >
Re-Vision.com

projects:
Simple Truths (and Complex Lies)

The Built World
Semblance Portrait Project
Back to Square One
Changing Chicago
Chicago's Reliance Building
US
Along the Mississippi River
The Work of Antoni Gaudí
Graffiti

places:
Morocco 2023
Beecher, Illinois
Iceland 2017
Cuba 2015
Providence, Rhode Island
Greece 2013
Eastern Europe 2013
Israel 2010
Paris, France
Puebla, Mexico 2009
Puerto Rico 2009
Barcelona 2007
Rome, Italy 2006

archive:
Graphics, sounds, and other ancient
items from the dawn of the Web.


FWIW:
Biography

©
Jay Boersma