PDA

View Full Version : Rotating Images In Puzzle



MommaCassie
01-23-2006, 04:21 AM
Is there a way to add code to the DHTML Puzzle to have it rotate images each week or each time played either from a list of images or from a group of images published in the same place?

Clickety here for the script in question (http://www.dynamicdrive.com/dynamicindex12/dhtmlpuzzle.htm)

jscheuer1
01-23-2006, 06:10 AM
Assuming all of the images are of the same dimensions, this should do nicely. Use as many entries to the randomImages array as you like, the more entries, the less likely accidental repeats will be (additions/changes red):


/*
DHTML puzzle script (By Davey Erwin, daverwin@hotmail.com, http://daverwin.homepage.com/)
Modified slightly/ permission granted to Dynamic Drive to feature script in archive
For full source, usage terms, and 100's more DHTML scripts, visit http://dynamicdrive.com
*/

randomImages=new Array()
randomImages[0]='photo1.jpg'
randomImages[1]='photo2.jpg'
randomImages[2]='photo3.jpg'

randomImages.sort(function() {return 0.5 - Math.random();})

//1) Specify whether puzzle should be rendered in NS 4.
// "0" disables it (for use when you wish to place the puzzle inside table)
var display_in_NS=1

//2) Configure second and third parameter below for puzzle image/size
//Make width and height divisible by 3
myPuz=new Puzzle('myPuz',randomImages[0],141,255)

MommaCassie
01-23-2006, 05:03 PM
Thank you very much! :D