Tassie
10-23-2003, 05:37 AM
I am looking for a script to change a set of jpg images continuously on a web page. An example of this is on www.mwebb.com.au
|
Click to See Complete Forum and Search --> : Changing Images Tassie 10-23-2003, 05:37 AM I am looking for a script to change a set of jpg images continuously on a web page. An example of this is on www.mwebb.com.au clairec666 10-23-2003, 05:50 AM I had a look at the site you mentioned but the picture thing wasn't working........ However, I can guess what you mean Do you want to create a continuous loop of pictures that change every few seconds? Insert the following in the script block var view = 0; function viewpics() { var pics = new Array("pic.gif","pic2.gif") // insert file names var picture = new Array() for (i=0; i<pics.length; i++) { picture[i] = new Image(); picture[i].src = pics[i]; } // that will load your pictures onto the page document.images.img1.src = picture[view].src; view++; if (view>pics.length) view = 0; // this returns the sequence to the beginning window.setTimeout("viewpics(),2000") // this currently shows a new pic every 2 seconds } Then change the body tag to this: <body onload="viewpics()"> Position the image where you want it on the page, with the tag <img src="" name="img1"> I apologise for the lack of 'cross-browser capability' because I'm only used to IE Also, if it doesn't work, check all my spelling because I haven't tested it yet Tassie 10-23-2003, 07:23 AM Thanks Claire, I will give that a try and see how it goes. Most appreciated. Tassie. webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |