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 >
photographs:

Semblance Portrait Project
The Built World
Greece
Hungary/Czech Republic
Poland
Graffiti
Simple Truths
Israel


Paris
Puebla, Mexico
Spain
Along the Mississippi
Italy
Santa Fe
The Reliance Building
Providence
archive:

Webwork
The Web Page from Hell
The Portals Project
Transition
Insights
Internet Spelling Guide
Ape Silverback (Primate Ruminations)
Revenge of the Movie Poster
GIFs 4 Us
The Web Rules
Webpix
Backgrounds 4 Us
Webpaper
Digital Sketches
Fonts
Sounds
© Jay Boersma   See also jayboersma.com