Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cross Browser Slideshow? 1

Status
Not open for further replies.

GaryCam

Programmer
Dec 16, 2003
69
US
I'm a total newbie & can't get this slideshow script to run in FF or Safari. Works fine in IE. Can anyone help me?

Here's the script:

var slideCache = new Array();
function RunSlideShow(pictureName,imageFiles,displaySecs)
{
var imageSeparator = imageFiles.indexOf(";");
var nextImage = imageFiles.substring(0,imageSeparator);
if (document.all)
{
document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
document.getElementById(pictureName).filters.blendTrans.Apply();
}
document.getElementById(pictureName).src = nextImage;
if (document.all)
{
document.getElementById(pictureName).filters.blendTrans.Play();
}
var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)
+ ';' + nextImage;
setTimeout("RunSlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")",
displaySecs*1000);

imageSeparator = futureImages.indexOf(";");
nextImage = futureImages.substring(0,imageSeparator);
if (slideCache[nextImage] == null) {
slideCache[nextImage] = new Image;
slideCache[nextImage].src = nextImage;
}
}


Here's the HTML:

<DIV>
<IMG src="images/1a.gif" name="banner1" width="200" height="200">
<script language="JavaScript">
setTimeout('RunSlideShow("banner1","images/1a.gif;images/3.gif;images/7.gif;images/9.gif;images/8a.gif;images/14.jpg",5)',100)
</script>
</DIV>

Thanks in advance,
Gary
 
the document.all collection is IE-specific, so that's the precise reason your slideshow only works in IE.

the original author of this script most likely used the document.all test because he/she used filters to transition the "slides".

if you'd like a cross-browser solution, I suggest searching for another with google. Dynamic Drive ( is another good resource.



*cLFlaVA
----------------------------
[tt]( <P> <B>)13 * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top