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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple slide show JavaScript?

Status
Not open for further replies.

crispin

Technical User
Mar 20, 2001
2
US
Hi everybody,

New JavaScript user here. I'm designing a sight for which I wanted to integrate the nifty javascript slideshow DHTML I found at another site. But I got the bright Idea of running three slideshows at once on the same page - i.e. there would be three boxes (in different table cells on the page) that would feature images which alternately faded into one another ...

Well, I wrote the portion of the script that's supposed to go between the <HEAD> tags and I wrote the portion that's supposed to go between the <BODY> tags - everything worked great! From there I copied what I had written in the <BODY> tags for table cells 2 and 3 (changing the image src=&quot;x&quot; to the appropriate images) and .... NOTHING works now.

What gives? This is the first time I've tried to incorporate JavaScript into a site ... Does it not work if you're running two scripts on the same page?

Any help will be much appreciated ...
 
you can run any number of scripts ... sounds like there's something in the code you didn't fully understood and you modified it and it's not working anymore ... but if you don't post RELEVANT parts of your code, we won't be able to help :-(
 
okay, here's the <HEAD> part:

<script language=&quot;JavaScript1.2&quot;>
function reapply(){
setTimeout(&quot;slideit()&quot;,2000)
return true
}
window.onerror=reapply
</script>
<script language=&quot;JavaScript1.1&quot;>
<!--
var image1=new Image()
image1.src=&quot;image-1.gif&quot;
var image2=new Image()
image2.src=&quot;image-2.gif&quot;
var image3=new Image()
image3.src=&quot;image-3.gif&quot;
//-->
</script>

and here's the <BODY> part:

<script>
<!--
var number_of_images=3
var speed=3
var step=1
var whichimage=1
function slideit(){
if (!document.images)
return
if (document.all)
slide.filters.blendTrans.apply()
document.images.slide.src=eval(&quot;image&quot;+step+&quot;.src&quot;)
if (document.all)
slide.filters.blendTrans.play()
whichimage=step
if (step<number_of_images)
step++
else
step=1
if (document.all)
setTimeout(&quot;slideit()&quot;,speed*1000+3000)
else
setTimeout(&quot;slideit()&quot;,speed*1000)
}
function slidelink(){
if (whichimage==1)
window.location=&quot; here.htm&quot;
else if (whichimage==2)
window.location=&quot; here.htm&quot;
else if (whichimage==3)
window.location=&quot; here.htm&quot;
}
//-->
</script>

Like I said, it works fine and looks great. But how do I have a second (or third) slideshow - with different images - running on the same page? Anybody? Bueller?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top