squarkman
Technical User
- Mar 10, 2008
- 34
Greetings:
Please see the script below.
This is a photo gallery with changing captions. The photos show and change fine until I added the myCaption Array so I could add captions. After adding the Array, the pictures won't show.
Any help would be greatly appreciated.
Thanks
Rocky
---------------------------------------------------------
// List text captions
var myCaption= new Array(24)
myCaption[00]= "apix001";
myCaption[01]= "apix002";
myCaption[02]= "apix003";
myCaption[03]= "apix004";
myCaption[04]= "apix005";
myCaption[05]= "apix006";
myCaption[06]= "apix007";
myCaption[07]= "apix008";
myCaption[08]= "apix009";
myCaption[09]= "apix010";
myCaption[10]= "apix011";
myCaption[11]= "apix012";
myCaption[12]= "apix013";
myCaption[13]= "apix014";
myCaption[14]= "apix015";
myCaption{15]= "apix016";
myCaption[16]= "apix017";
myCaption[17]= "apix018";
myCaption[18]= "apix019";
myCaption[19]= "apix020";
myCaption[20]= "apix021";
myCaption[21]= "apix022";
myCaption[22]= "apix023";
myCaption[23]= "apix024";
myCaption[24]= "apix025";
// List of image filenames without extension
var myImg= new Array(24)
myImg[00]= "pix001";
myImg[01]= "pix002";
myImg[02]= "pix003";
myImg[03]= "pix004";
myImg[04]= "pix005";
myImg[05]= "pix006";
myImg[06]= "pix007";
myImg[07]= "pix008";
myImg[08]= "pix009";
myImg[09]= "pix010";
myImg[10]= "pix011";
myImg[11]= "pix012";
myImg[12]= "pix013";
myImg[13]= "pix014";
myImg[14]= "pix015";
myImg[15]= "pix016";
myImg[16]= "pix017";
myImg[17]= "pix018";
myImg[18]= "pix019";
myImg[19]= "pix020";
myImg[20]= "pix021";
myImg[21]= "pix022";
myImg[22]= "pix023";
myImg[23]= "pix024";
myImg[24]= "pix025";
// Tell browser where to find the image
myImgSrc = "/dogdaysinla/";
// Tell browser the type of file
myImgEnd = ".jpg"
var i = 0;
// Create function to load image
function loadImg(){
document.imgSrc.src = myImgSrc + myImg + myImgEnd;
document.getElementById('caption') = myCaption;
}
// Create link function to switch image backward
function prev(){
if(i<1){
var l = i+=24
} else {
var l = i-=1;
}
document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
document.getElementById('caption') = myCaption[l];
}
// Create link function to switch image forward
function next(){
if(i>23){
var l = i-=24
} else {
var l = i+=1;
}
document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
document.getElementById('caption') = myCaption[l];
}
// Load function after page loads
window.onload=loadImg;
-------------------------------------
Please see the script below.
This is a photo gallery with changing captions. The photos show and change fine until I added the myCaption Array so I could add captions. After adding the Array, the pictures won't show.
Any help would be greatly appreciated.
Thanks
Rocky
---------------------------------------------------------
// List text captions
var myCaption= new Array(24)
myCaption[00]= "apix001";
myCaption[01]= "apix002";
myCaption[02]= "apix003";
myCaption[03]= "apix004";
myCaption[04]= "apix005";
myCaption[05]= "apix006";
myCaption[06]= "apix007";
myCaption[07]= "apix008";
myCaption[08]= "apix009";
myCaption[09]= "apix010";
myCaption[10]= "apix011";
myCaption[11]= "apix012";
myCaption[12]= "apix013";
myCaption[13]= "apix014";
myCaption[14]= "apix015";
myCaption{15]= "apix016";
myCaption[16]= "apix017";
myCaption[17]= "apix018";
myCaption[18]= "apix019";
myCaption[19]= "apix020";
myCaption[20]= "apix021";
myCaption[21]= "apix022";
myCaption[22]= "apix023";
myCaption[23]= "apix024";
myCaption[24]= "apix025";
// List of image filenames without extension
var myImg= new Array(24)
myImg[00]= "pix001";
myImg[01]= "pix002";
myImg[02]= "pix003";
myImg[03]= "pix004";
myImg[04]= "pix005";
myImg[05]= "pix006";
myImg[06]= "pix007";
myImg[07]= "pix008";
myImg[08]= "pix009";
myImg[09]= "pix010";
myImg[10]= "pix011";
myImg[11]= "pix012";
myImg[12]= "pix013";
myImg[13]= "pix014";
myImg[14]= "pix015";
myImg[15]= "pix016";
myImg[16]= "pix017";
myImg[17]= "pix018";
myImg[18]= "pix019";
myImg[19]= "pix020";
myImg[20]= "pix021";
myImg[21]= "pix022";
myImg[22]= "pix023";
myImg[23]= "pix024";
myImg[24]= "pix025";
// Tell browser where to find the image
myImgSrc = "/dogdaysinla/";
// Tell browser the type of file
myImgEnd = ".jpg"
var i = 0;
// Create function to load image
function loadImg(){
document.imgSrc.src = myImgSrc + myImg + myImgEnd;
document.getElementById('caption') = myCaption;
}
// Create link function to switch image backward
function prev(){
if(i<1){
var l = i+=24
} else {
var l = i-=1;
}
document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
document.getElementById('caption') = myCaption[l];
}
// Create link function to switch image forward
function next(){
if(i>23){
var l = i-=24
} else {
var l = i+=1;
}
document.imgSrc.src = myImgSrc + myImg[l] + myImgEnd;
document.getElementById('caption') = myCaption[l];
}
// Load function after page loads
window.onload=loadImg;
-------------------------------------