Jump to content

slideshow in javascript


phpgoal

Recommended Posts

Hello,

 

Below code works fine for slide show. But I dont want the slide show to run once i come to the page. I want to see slide show start when i call it. How can I do it?

 

If I dont use callnow function, it works just fine. If I use the function, it does not work. It is stuck at car1 picture.

 
<script>callnow();
function callnow(){var image1=new Image()
image1.src="car1.jpg"
var image2=new Image()
image2.src="car5.jpg"
var aa = '<img src=\"car1.jpg\" name=\"slide\" width="435" height="500" 
/>';document.write(aa);



var step=1
function slideit(){
// var aa = '<img src=\"car1.jpg\" name=\"slide\" width="435" height="500" 
/>';// document.write(aa);////if browser does not support the image 
object, exit.
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
if (step<2)
step++
else
step=1
//call function "slideit()" every 2.5 seconds
setTimeout("slideit()",2500)
}
slideit()
//-->}</script>
Link to comment
https://forums.phpfreaks.com/topic/279215-slideshow-in-javascript/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.