PDA

View Full Version : Java slideshow only works in template


Andymoses
03-19-2009, 04:49 PM
I got this code from dynamicdrive.com as I wanted a simple sldieshow that blended the images when changing. I put my images in, and it works fine in the DW template when viewing in the browser, but in any page using that template, it only finds the first image () then fades to the little red cross. Why does this happen and can I fix it?


<head>
<script language="JavaScript1.1">
<!--
//specify interval between slide (in mili seconds)
var slidespeed=3000
//specify images
var slideimages=new Array("../assets/logo_bl-out100x.gif","../assets/logo_bl-fill100x.gif","../assets/logo_r-out100x.gif","../assets/logo_r-fill100x.gif")
//specify corresponding links
var slidelinks=new Array("http://www.jitsufoundation.org")
var newwindow=1 //open links in new window? 1=yes, 0=no
var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}
function gotoshow(){
if (newwindow)
window.open(slidelinks[whichlink])
else
window.location=slidelinks[whichlink]
}
//-->
</script>
</head>

<body>
<p><a href="javascript:gotoshow()"><img src="../assets/logo_bl-out100x.gif" name="slide" border=0 style="filter:blendTrans(duration=2)" width=100 height=100></a>
<script language="JavaScript1.1">
<!--
var whichlink=0
var whichimage=0
var blenddelay=(ie)? document.images.slide.filters[0].duration*1000 : 0
function slideit(){
if (!document.images) return
if (ie) document.images.slide.filters[0].apply()
document.images.slide.src=imageholder[whichimage].src
if (ie) document.images.slide.filters[0].play()
whichlink=whichimage
whichimage=(whichimage<slideimages.length-1)? whichimage+1 : 0
setTimeout("slideit()",slidespeed+blenddelay)
}
slideit()
//-->
</script>
</body>

domedia
03-24-2009, 03:03 AM
It means that the path to the image is wrong. Can you put this on the web somewhere?

Andymoses
03-29-2009, 12:12 PM
Yeah the path must have been wrong. I put in the exact path for each file and now it works fine.

Sorry to bother y'all!

domedia
03-30-2009, 03:44 AM
No bother! Nice you got it solved.