...

View Full Version : Need Help with JS Slideshow Script



jjfletch
01-30-2006, 04:41 AM
The script below is supposed to let the user move through photos like a slideshow. But, the pictures will not load. Can someone help me with this script?

First, I'll post the code:



<script language="Javascript">

var photos=new Array()
var photoslink=new Array()
var which=0


photos[0] = "RC1.jpg"
photos[1] = "RC2.jpg"
photos[2] = "RC3.jpg"
photos[3] = "RC4.jpg"
photos[4] = "RC5.jpg"
photos[5] = "RC6.jpg"
photos[6] = "RC7.jpg"
photos[7] = "RC8.jpg"
photos[8] = "RC9.jpg"

var linkornot=0


//do NOT edit pass this line

var preloadedimages=new Array()
for (i=0;i<photos.length;i++){
preloadedimages[i]=new Image()
preloadedimages[i].src=photos[i]
}


function applyeffect(){
if (document.all && photoslider.filters){
photoslider.filters.revealTrans.Transition=Math.floor(Math.random()*23)
photoslider.filters.revealTrans.stop()
photoslider.filters.revealTrans.apply()
}
}



function playeffect(){
if (document.all && photoslider.filters)
photoslider.filters.revealTrans.play()
}

function keeptrack(){
window.status="Image "+(which+1)+" of "+photos.length
}


function backward(){
if (which>0){
which--
applyeffect()
document.images.photoslider.src=photos[which]
playeffect()
keeptrack()
}
}

function forward(){
if (which<photos.length-1){
which++
applyeffect()
document.images.photoslider.src=photos[which]
playeffect()
keeptrack()
}
}

function transport(){
window.location=photoslink[which]
}

</script>


And from the HTML:



<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" colspan="2" height="22"><center>
<script language="Javascript">
if (linkornot==1)
document.write('<a href="javascript:transport()">')
document.write('<img src="'+photos[0]+'" name="photoslider" style="filter:revealTrans(duration=2,transition=23)"
border=0>')
if (linkornot==1)
document.write('</a>')
</script>
</center></td>

</tr>
<tr>
<td width="50%" height="21"><p align="left">
<input type="submit" name="prev" value="<" onClick="backward();return false"></td>
<td width="50%" height="21">
<input type="submit" name="next" value=">" onClick="forward();return false"></td>
</tr>
</table>


Thank you experts.

glenngv
01-30-2006, 05:19 AM
Are the images located in the same location as that page?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum