Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Slide Show , add captions

4:45 am on Jul 1, 2003 (gmt 0)

10+ Year Member

I need to add captions to this script. I have read I need to add a new array but I don't know where in this script to add it. (or exactly how) And I'm sure I need something to call text from the captions list? Also, if I use this as an external script, would the captions array be embedded here or should it be a second script, and if so, how do you get them to time the pics and captions together?

I also read something about needing a form or text area. I have a css div, will I be changing that div to a form?

Sorry it's so long, I took out the references to the other 59 pics in the list, but didn't know what else I could shave out

Dian :)

<script language="JavaScript">

var interval = 1000;
var random_display = 0;
var image_dir = "bbq/";
var ImageNum = 0;
imageArray = new Array();

imageArray[ImageNum++] = new imageItem(image_dir + "01.jpg");
imageArray[ImageNum++] = new imageItem(image_dir + "02.jpg");

var number_of_image = imageArray.length;
function imageItem(image_location) {
this.image_item = new Image();
this.image_item.src = image_location;
function get_ImageItemLocation(imageObj) {
function randNum(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
function getNextImage() {
if (random_display) {
ImageNum = randNum(0, number_of_image-1);
else {
ImageNum = (ImageNum+1) % number_of_image;
var new_image = get_ImageItemLocation(imageArray[ImageNum]);

function getPrevImage() {
ImageNum = (ImageNum-1) % number_of_image;
var new_image = get_ImageItemLocation(imageArray[ImageNum]);

function prevImage(place) {
var new_image = getPrevImage();
document[place].src = new_image;

function rotateImage(place) {
var new_image = getNextImage();
document[place].src = new_image;
var recur_call = "rotateImage('"+place+"')";
timerID = setTimeout(recur_call, interval);


Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month