I have a javascript that reads a recordset that has 2 images stored in it:
<script>
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000
// Duration of crossfade (seconds)
var crossFadeDuration = 3
// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = '../uploads/<%=rs("FileName1")%>'
Pic[1] = '../uploads/<%=rs("FileName2")%>'
//Pic[2] = '3.jpg'
//Pic[3] = '4.jpg'
//Pic[4] = '5.jpg'
var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++){
preLoad = new Image()
preLoad.src = Pic
}
function runSlideShow(){
if (document.all){
document.images.SlideShow.style.filter="blendTrans(duration=2)"
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
document.images.SlideShow.filters.blendTrans.Apply()
}
document.images.SlideShow.src = preLoad[j].src
if (document.all){
document.images.SlideShow.filters.blendTrans.Play()
}
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>
This code displays the two images in a slideshow fashion:
<img src="../uploads/<%=rs("FileName1")%>" name='SlideShow' width=150 height=150>
Here's my problem. If both images exist in the fields FileName1 and FileName2, the script works fine. There will be sometimes where I'll only have FileName1 image and no image for FileName2. Is there a way for the script to see if fileName2 is empty to just use FileName1? If FileName2 is empty, I get a no image displayed when the script rotates to that image.
<script>
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000
// Duration of crossfade (seconds)
var crossFadeDuration = 3
// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = '../uploads/<%=rs("FileName1")%>'
Pic[1] = '../uploads/<%=rs("FileName2")%>'
//Pic[2] = '3.jpg'
//Pic[3] = '4.jpg'
//Pic[4] = '5.jpg'
var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++){
preLoad = new Image()
preLoad.src = Pic
}
function runSlideShow(){
if (document.all){
document.images.SlideShow.style.filter="blendTrans(duration=2)"
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
document.images.SlideShow.filters.blendTrans.Apply()
}
document.images.SlideShow.src = preLoad[j].src
if (document.all){
document.images.SlideShow.filters.blendTrans.Play()
}
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runSlideShow()', slideShowSpeed)
}
</script>
This code displays the two images in a slideshow fashion:
<img src="../uploads/<%=rs("FileName1")%>" name='SlideShow' width=150 height=150>
Here's my problem. If both images exist in the fields FileName1 and FileName2, the script works fine. There will be sometimes where I'll only have FileName1 image and no image for FileName2. Is there a way for the script to see if fileName2 is empty to just use FileName1? If FileName2 is empty, I get a no image displayed when the script rotates to that image.